Skip to content

Instantly share code, notes, and snippets.

@slopeofhope81
Created January 24, 2014 18:01
Show Gist options
  • Save slopeofhope81/8602617 to your computer and use it in GitHub Desktop.
Save slopeofhope81/8602617 to your computer and use it in GitHub Desktop.
/*Write a function range that takes one argument, a positive number, and returns an array containing all numbers from 0 up to and including the given number.*/
var arr = [];
function list(n) {
for (var i = 0; i <= n; i++) {
arr[i] = i;
}
document.write(arr);
}
list(20);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment