Arrays as Objects in JavaScript
Arrays are actually a special
case of objects. This can be confirmed
by checking an array with the
typeof operator:
console.log(typeof []); // will output 'object'
Without running the code, determine what will be displayed in the console:
console.log( typeof {x: 1, y: 2, z: 3} );
Without running the code, determine what will be displayed in the console:
console.log( typeof [1, 2, 3] );
Without running the code, determine what will be displayed in the console:
let arr = [1, 2, 3];
console.log( typeof arr );
Without running the code, determine what will be displayed in the console:
let arr = [1, 2, 3];
console.log( typeof arr[0] );
Without running the code, determine what will be displayed in the console:
let arr = ['1', '2', '3'];
console.log( typeof arr[0] );