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​