Skip to content

Instantly share code, notes, and snippets.

@katherholt
Created July 26, 2016 06:44
Show Gist options
  • Save katherholt/3f2c9239d555e8532d507fcf7d73b5f3 to your computer and use it in GitHub Desktop.
Save katherholt/3f2c9239d555e8532d507fcf7d73b5f3 to your computer and use it in GitHub Desktop.
// Write a function arrayOfLight(x) (get it? Lighthouse…? Come on!) which takes one parameter, a positive number, and return
// an array containing all numbers from 0 up to and including the given number.
function arrayOfLight(x) {
var array = [];
for(var y = 0; y <= x; y++) {
array.push(y);
}
return array;
};
arrayOfLight(4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment