Here is an example of an object literal:
var product = {
name: "Chai",
Category: "Tea",
Country: "India",
supplier: {
name: "ACME Tea Of India",
location : "New Delhi"
},
related: ["Earl Grey", "Green Tea", "Dark Tea", "White Tea"],
display: function () {
console.log(this);
}
};
If you open this in the browser you will see that product object is made up of properties, another object called supplier, an array related, and a function called display()
Thanks for your post. I’ve been thinking about writing a very comparable post over the last couple of weeks, I’ll probably keep it short and sweet and link to this instead if thats cool. Thanks. https://www.whocall.biz
ReplyDeleteDefine an object using { } brackets and key:values and their correlates differ by a comma. Depending upon the specific circumstances, it would either be a bare word which would be the name of the property or a literal or a function. I am also confuse in javascript program But recently I buy dissertation service in program which is very nice if you are stuck.
ReplyDelete