Objektien typistys JavaScriptissä

Objekteilla on oma tietotyyppinsä, jota kutsutaan 'object'. Tarkistetaan typeof-operaattorilla:

javascriptconsole.log(typeof {}); // tulostaa 'object'
Задание 1

Määritä konsoliin tulostuva arvo ajamatta koodia:

javascriptconsole.log( typeof {x: 1, y: 2, z: 3} );
Задание 2

Määritä konsoliin tulostuva arvo ajamatta koodia:

javascriptconsole.log( typeof {} );
Задание 3

Määritä konsoliin tulostuva arvo ajamatta koodia:

javascriptlet obj = {x: 1, y: 2, z: 3};
console.log( typeof obj );
Задание 4

Määritä konsoliin tulostuva arvo ajamatta koodia:

javascriptlet obj = {x: 1, y: 2, z: 3};
console.log( typeof obj['x'] );