OBJECT Objects are same in all programming languages i.e they represent real-world things that we want to represent inside our programs with characteristics/properties and methods. In JavaScript Objects are kind of String/Number Index Array represented inside curly brackets Var obj = { 1: “NAME”, "Maths" :100 } KEY VALUE PAIR In the above example obj is an object with 2 properties with key as 1 and Maths and value as Name and 100 .Here the index are called as KEY.KEY :VALUE pair together called as entries Object literals are a comma-separated list of key-value pairs wrapped in curly braces. Object literal property values can be of any data type, including array literals, functions, nested object literals or primitive data type. Obj Values in the above can be accessed via Dot notation i.e obj.1 ,obj.Maths or via a square bracket notation i.e obj[1] ,obj[“Maths”] Object.assign() METHOD As we discussed earlier in JavaScript Objects are kind of...
Comments
Post a Comment