Section 6 - Building Objects
typeof, instanceof, and Figuring out what Type it is
var a = 3;
console.log(typeof a); //number
var a = true;
console.log(typeof a); //boolean
var a = "string";
console.log(typeof a); //string
var a = {};
console.log(typeof a); //object var a = [];
console.log(typeof a); //object
console.log(Object.prototype.toString.call(a)); //object array function Person(name) {
this.firstname = name;
}
var a = new Person('dan');
console.log(typeof a); //object
console.log(a instanceof Person); //trueStrict Mode
PreviousSection 5 - Object Oriented Javascript and Prototypal InheritanceNextSection 7 - Odds and Ends
Last updated