The property values of javascript objects refer to the values related to JavaScript objects; JavaScript objects are a collection of unordered properties. Property values can usually be modified, added and deleted, but some properties are read-only. The syntax for accessing object properties is "objectName.property", "objectName["property"]", or "objectName[expression]".
The operating environment of this tutorial: Windows 10 system, JavaScript version 1.8.5, Dell G3 computer.
Properties are the most important part of any JavaScript object.
Properties refer to values associated with JavaScript objects.
JavaScript objects are unordered collections of properties.
Properties can generally be modified, added, and deleted, but some properties are read-only.
The syntax for accessing object properties is:
objectName.property // person.ageor:
objectName["property"] // person["age"]or:
objectName[expression] // x = "age"; person[x]The expression must evaluate to a property name.
Examples are as follows:
<!DOCTYPE html><html><body><h1>JavaScript Object Properties</h1><p>There are two different ways to access object properties:</p><p>You can use .property or ["property "]. </p><p id="demo"></p><script>var person = { firstname:"Bill", lastname:"Gates", age:62, eyecolor:"blue"};document.getElementById( "demo").innerHTML = person.firstname + " is " + person.age + " years old.";</script></body></html>Output result: