Skip to content

Instantly share code, notes, and snippets.

@topherPedersen
Last active June 27, 2019 21:24
Show Gist options
  • Select an option

  • Save topherPedersen/b1a24dbd165556aa10d7f4e6ea337f7b to your computer and use it in GitHub Desktop.

Select an option

Save topherPedersen/b1a24dbd165556aa10d7f4e6ea337f7b to your computer and use it in GitHub Desktop.
Learn JavaScript in 20 Minutes
// 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