Skip to content

Instantly share code, notes, and snippets.

@ian128K
Created October 2, 2014 05:33
Show Gist options
  • Save ian128K/6b868166d4b4796f162b to your computer and use it in GitHub Desktop.
Save ian128K/6b868166d4b4796f162b to your computer and use it in GitHub Desktop.
Function for adding all numbers from 1 to a given number
function addFromOneToNum(num) {
var output;
output = num;
for(var i = 1; i < num; i++) {
output += i;
}
return output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment