Basic Programming Concepts

Variable assignment

  var x = 12
  var blah = "some text that i'm writing right now!"
  blah = x
  y = blah - x

Arrays

var universities = ["UofT", "Western", "McMaster"];
universities[0] //will return "UofT"

Conditional statements

if (condition) {
  //  block of code to be executed if the condition is true
}

An example from https://www.w3schools.com/js/js_if_else.asp

if (hour < 18) {
  greeting = "Good day";
}
else {
  greeting = "Good evening"
}

What would this return now?

Loops

var i;
for (i = 0; i < universities.length; i++) {
  text += universities[i] + "<br>";
}

/*will print:
 UofT
 Western
 McMaster
 */

To the board!

let’s go