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?

  1. objectName:propertyName
  2. propertyName
  3. objectName["propertyName"]
  4. 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"].

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.