Objects Flashcards
1
Q
What is an Object ?
A
An object is a standalone entity, with properties and type.
For example.
A cup is an object, with properties.
A cup has a color, a design, weight, a material it is made of, etc. The same way, JavaScript objects can have properties, which define their characteristics
2
Q
Example of Object
Reveal Answer
A
const Rajbio = { firstName: 'Raj', lastName: 'Oza', age: 2047 - 1984, job: 'coder', friends1: ['hemal', 'samir', 'Amit', 'Manish'] }
console.log(Rajbio)
3
Q
Coding Challenge ( Objects )
Create an object called ‘myCountry’ for a country of your choice, containing
properties ‘country’, ‘capital’, ‘language’, ‘population’ and
‘neighbours’ (an array like we used in previous assignments)
A
const myCountry = { country: 'Finland', capital: 'Helsinki', language: 'finnish', population: 6, neighbours: ['Norway', 'Sweden', 'Russia'] };
console.log(myCountry)