Skip to content

Instantly share code, notes, and snippets.

@masterfermin02
Created December 7, 2018 19:15
Show Gist options
  • Save masterfermin02/9b3debe1e1cc21b46c194dcfa4ead899 to your computer and use it in GitHub Desktop.
Save masterfermin02/9b3debe1e1cc21b46c194dcfa4ead899 to your computer and use it in GitHub Desktop.
function square_first_200()
{
var result = [];
for(var i = 1; i <= 200; i++)
{
result.push(i*i);
}
return result;
}
function square_first_200_recursive(number = 200, result = [])
{
if(number < 1) return 1;
square_first_200_recursive(number -1, result)
result.push(number * number);
return result;
}
// console.log(square_first_200_recursive());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment