TypeOf Operator
Video
JavaScript Notes
JavaScript
// typeof.js
// The typeof operator
//
let log = console.log;
let str = "Winchester"; // typeof returns string
let num = 13; // typeof returns number
let bool = true; // typeof returns boolean
let obj = {'prop':'Dean'}; // typeof returns object
let arr = ['Sam', 'Castiel', 'Crowley']; // typeof returns object
let today = new Date( ); // typeof returns object
let dt = Date( ); // typeof returns string
let f = function( ){ // typeof returns function
// Hi. I’m a function
}
log(typeof NaN); // typeof returns number
log(typeof undefined); // typeof returns undefined
log(typeof null); // typeof returns object
Feedback
Submit and view feedback