Masīvi kā objekti JavaScript
Masīvi patiesībā ir īpašs
objektu gadījums. To var pārbaudīt,
ja pārbauda masīvu ar operatoru
typeof:
console.log(typeof []); // izvadīs 'object'
Nepalaižot kodu, nosakiet, ko izvadīs ekrānā konsolē:
console.log( typeof {x: 1, y: 2, z: 3} );
Nepalaižot kodu, nosakiet, ko izvadīs konsolē:
console.log( typeof [1, 2, 3] );
Nepalaižot kodu, nosakiet, ko izvadīs konsolē:
let arr = [1, 2, 3];
console.log( typeof arr );
Nepalaižot kodu, nosakiet, ko izvadīs konsolē:
let arr = [1, 2, 3];
console.log( typeof arr[0] );
Nepalaižot kodu, nosakiet, ko izvadīs konsolē:
let arr = ['1', '2', '3'];
console.log( typeof arr[0] );