Javascript – Objects

Javascript – Objects

In Javascript, objects are arrays where indexes are the property names. You can declare an object: var person = {}; The properties are separated with ‘,’ and the key/value for its property is separated with ‘:’. The property name can have single quotes, double quotes or nothing. name:”Kronos” ‘name’:”Kronos” “name”: “Kronos” You can access a property using ‘.’. If the property name starts with a number or is a reserved word then you have to use ‘[]’ and quotes: person.name = “Kronos”; person[‘1name’] = “Kronos”; An object can contain another…

Javascript – Objects Read More