JavaScript Object Properties
Description
Values of the type object are arbitrary collections of properties
Syntax
let tralala = {
distro: "Arch",
useWindows: false,
aListOfRandomThings: ["spoon", "fork", "modem", "keychain"],
}
console.log(tralala.distro)
console.log(tralala.useWindows)
console.log(tralala.aListOfRandomThings)
Invalid binding names
Properties with invalid binding names or numbers must be quoted:
let weirdObject = {
tralala: "Chipmunk",
"this is a long binding name with spaces": "Fill in some nonsensse here",
}
console.log(weirdObject)
Non existant property
Reading a non existant property returns undefined
let Object = {
thisExists: true,
}
console.log(Object.undefinedProperty) // undefined