airbnb style guide https://travishorn.com/setting-up-eslint-on-vs-code-with-airbnb-javascript-style-guide-6eb78a535ba6
name = 'chris' (makes name global)
var name = 'chris' (var deprecated, in ES6, now use let)
const name = 'chris'
const for arrays and objects can still be updated, however
hashes are called objects in JS
IF statements
if (something > 18) {
console.log("yay");
}
else if (blah) {
}
double equals (loose comparison) convert type before comparison, use triple equals for strict comparison
parseInt("1")
(1).toString()
interpolation:
`hello $(name)` (use backticks)
variables are blocked scoped, e.g.:
const students = []
for (let i = 0; i < 3; i++) {
let a_student = {}
a_student["name"] = prompt("What is your name?");
a_student["age"] = prompt("What is your age?");
students.push(a_student);
}
console.log(students)
need to have let a_student defined inside the for loop
function sayHello () {
console.log("Hello");
}
calling sayHello will pass the entire function, calling sayHello() will actually execute it