Created
November 30, 2015 20:02
-
-
Save reinhardt021/d7957590eb8a537fd2ee to your computer and use it in GitHub Desktop.
Array of Light
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var arrayOfLight = function (x) { | |
| // note that x must be a positive number | |
| // prints from 0 to that number | |
| var result = []; | |
| for (var i = 0; i <= x; i++) { | |
| result.push(i); | |
| } | |
| return result; | |
| }; | |
| var response = arrayOfLight(5); // = [0, 1, 2, 3, 4, 5] | |
| console.log(response); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <title>Array of Light</title> | |
| <script type="text/javascript" src="application.js"></script> | |
| </head> | |
| <body> | |
| <h1>Running script now</h1> | |
| <h2>check the console for outputs</h2> | |
| <p>Practicing basic JavaScript in the browser.</p> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment