Home »
MCQs »
JavaScript MCQs
Which is the correct syntax to access an object property in JavaScript?
48. Which is the correct syntax to access an object property in JavaScript?
- objectName:propertyName
- propertyName
- objectName["propertyName"]
- Both B. and C.
Answer: D) Both B. and C.
Explanation:
The properties of an object can we accessed using either objectName.propertyName or objectName["propertyName"].