JavaScript Objects
In JavaScript, almost "everything" is an object.
- Booleans can be objects (if defined with the
newkeyword) - Numbers can be objects (if defined with the
newkeyword) - Strings can be objects (if defined with the
newkeyword) - Dates are always objects
- Maths are always objects
- Regular expressions are always objects
- Arrays are always objects
- Functions are always objects
- Objects are always objects
All JavaScript values, except primitives, are objects.
JavaScript Object Properties
Properties are the most important part of any JavaScript object.
JavaScript Properties
Properties are the values associated with a JavaScript object.
A JavaScript object is a collection of unordered properties.
Properties can usually be changed, added, and deleted, but some are read only.
Accessing JavaScript Properties
The syntax for accessing the property of an object is:
objectName.property // person.ageor
objectName["property"] // person["age"]or
objectName[expression] // x = "age"; person[x]
Comments
Post a Comment