forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 2
Challenge Accessing Objects Properties With The Dot Operator
Quincy Larson edited this page Aug 20, 2016
·
1 revision
There are two ways to access the properties of an object: the dot operator (.
) and bracket notation ([]
), similar to an array.
The dot operator is what you use when you know the name of the property you're trying to access ahead of time.
Here is a sample of using the dot operator (.
) to read an object property:
var myObj = {
prop1: "val1",
prop2: "val2"
};
myObj.prop1; // val1
myObj.prop2; // val2
Learn to code and help nonprofits. Join our open source community in 15 seconds at http://freecodecamp.com
Follow our Medium blog
Follow Quincy on Quora
Follow us on Twitter
Like us on Facebook
And be sure to click the "Star" button in the upper right of this page.
New to Free Code Camp?
JS Concepts
JS Language Reference
- arguments
- Array.prototype.filter
- Array.prototype.indexOf
- Array.prototype.map
- Array.prototype.pop
- Array.prototype.push
- Array.prototype.shift
- Array.prototype.slice
- Array.prototype.some
- Array.prototype.toString
- Boolean
- for loop
- for..in loop
- for..of loop
- String.prototype.split
- String.prototype.toLowerCase
- String.prototype.toUpperCase
- undefined
Other Links