InterviewSolution
| 1. |
What Are Object Properties? |
|
Answer» Object properties can be any of the three primitive DATA types, or any of the ABSTRACT data types, such as another object. Object properties are usually variables that are USED internally in the object's methods, but can ALSO be globally visible variables that are used. The syntax for ADDING a property to an object is: objectName.objectProperty = propertyValue; For example − The following code gets the document title using the "title" property of the document object. var str = document.title; Object properties can be any of the three primitive data types, or any of the abstract data types, such as another object. Object properties are usually variables that are used internally in the object's methods, but can also be globally visible variables that are used. The syntax for adding a property to an object is: objectName.objectProperty = propertyValue; For example − The following code gets the document title using the "title" property of the document object. var str = document.title; |
|