js-mentorship-razvan / javascript

Javascript study notes
GNU General Public License v3.0
22 stars 2 forks source link

Gauß needs help! (Sums of a lot of numbers). #467

Closed RazvanBugoi closed 4 years ago

RazvanBugoi commented 4 years ago

https://www.codewars.com/kata/54df2067ecaa226eca000229/train/javascript

RazvanBugoi commented 4 years ago
function f(n){
  return n > 0 && Number.isInteger(n) ? (1/2) * n * (n + 1) : false;
}