+ 1
Objects, Properties , Functions
Having difficulties in understanding objects, properties,etc.. can some please take me through it.. I mean,the first two lessons in JavaScript intermediate 🙂
2 ответов
+ 1
Take this question as an example, there are several contents of different types, which the asker name, question title and question message.
So its data is an object, like:
var question = {
asker : "Mr Blank",
title : "Object, Property Function",
}
Note that
- Each item is separated with comma
- We use colon in each item, putting property name before colon and property content after colon.
When we want to use the content, we access by variable name dot property name, for example:
console.log(question.asker); // Mr. Blank
console.log(question.title); // Object, Property, Function