-Introducing Object Literals
-Creating Object Literals
-Modifying Objects
Introducing Object Literals
Objects are collection of properties. Properties are a key-value pair.
Rather than accessing data using index, we use custom keys.
const fitBitData = {
totalSteps : 308272,
totalMiles : 211.7,
avgCalorieBurn : 5755,
workoutsThisWeek : '5 of 7',
avgGoodSleep : '2 : 13'
};
Creating Object Literals
All data types can be used to create object literals
let comment = {
username: 'somethingSpecial43',
downVotes : 10,
upVotes : 211,
netScore : 120,
commentText : 'Taste like chicken',
tags : ['#hilarious', '#funny', '#silly'],
isGilded : false
};
Top comments (0)