Last active
June 27, 2019 21:24
-
-
Save topherPedersen/b1a24dbd165556aa10d7f4e6ea337f7b to your computer and use it in GitHub Desktop.
Learn JavaScript in 20 Minutes
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
| // Concept No. 1: Functions | |
| console.log("hello, world"); | |
| // Concept No. 2: Variables | |
| var myVariable = "Variables are containers which hold values."; | |
| // Concept No. 3: Arrays | |
| var myArray = []; | |
| myArray[0] = "moo"; | |
| myArray[1] = "zoo"; | |
| myArray[2] = "doo"; | |
| // Concept No. 4: Loops (for and while) | |
| for (var i = 0; i < myArray.length; i++) { | |
| console.log(myArray[i]); | |
| } | |
| i = 0; | |
| while (i < myArray.length) { | |
| console.log(myArray[i]); | |
| i++; | |
| } | |
| // Concept No. 5 If-Statements | |
| var mood = "engaged"; | |
| if (mood == "engaged") { | |
| console.log("What an exciting lesson on JavaScript!"); | |
| } else { | |
| console.log("This is quite a boring lessson on JavaScript..."); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment