- 1
Access the "color" property of the"hair"object using dot syntax.
what is answer this q pls tell me any body
7 Antworten
+ 6
hair.color
Or
hair['color']
0
There are two ways of accessing the object, either through the dot syntax or bracket notation.
Dot Syntax refers to using the object then a . afterwards. The previous used the example of document.write
Bracket notation requires the object to be on the outside of the bracket for example document['write']
For this question you have been asked to write using dot syntax , therefore the answer is:
hair.color
hair is the object (like in the example document is the object)
color is the property you are trying to access (like write in the example, although that was a method but it essentially wanted to be attached to the object, just like the property color).
Hope this makes it a bit clearer. :)
0
hair.color
Answer
0
hair.color
0
hair.color
hair['color']
- 1
not correct answer
- 1
hair.color