Skip to main content

Part 6

Prerequisite

#BIGWORD - Syntactic Sugar : A different way to Type something that doesn’t change how it works under the hood.

Section 7 - Odds and Ends

Chapter 65- Initialization

var peope = [
{
firstname: ‘Joe’,
lastname: ‘Doe’,
addresses: [
‘111 Main st’,
‘222 Third st’
]
},
{
firstname: ’Jane’,
lastname: ‘Doe’,
addresses: [
‘333 Main st’,
‘444 Fifth st’
],
greet: function(){
return ‘Hello’;
}
}
];

Chapter 66- 'tyepof', 'instaceof', and Figuring Out What Something Is

var a = 3;
console.log(typeof a); //number

var b = ‘Hello’;
console.log(typeof b); //string

var c = {};
console.log(typeof c); //object

var d = [];
console.log(typeof d); //object //weird
console.log(Object.prototype.toString.call(d)); //object Array //better

function Person(name){
this.name = name;
}

var e = new Person(‘Jane’);
console.log(typeof e); // object

console.log(e instanceof Person); //true
console.log(typeof undefined); //undefined // makes sense
console.log(typeof null); //object // a bug since, like , forever..

var z = function() { };
console.log(typeof z); //function

Chapter 67- Strict Mode

Example 1
var person ;
persom = {};
console.log(persom) // Object {}

Example 2
‘use strict’
var person ;
persom = {};
console.log(persom) // Uncaught reference error : persom is not defined
Credits