-
Notifications
You must be signed in to change notification settings - Fork 480
JavaScript 101 Types: Removed new Object
suggestion
#543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cc @ajpiano @kswedberg @rwaldron for review/further edit suggestions please? |
Yeah, definitely 👍 |
alert( people[ "person1" ].firstName ); | ||
alert( people[ "person2" ].firstName ); | ||
``` | ||
|
||
If a property is accessed that has not been defined, it will return a type of `undefined`. | ||
If a property is accessed that has not been defined, it will be the value `undefined`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will have the value, rather than be the value?
@gnarf: Much better! |
Updated with Karl's suggestion - going to wait for at least one more set of eyes before landing |
people[ "person1" ] = person1; | ||
people[ "person2" ] = person2; | ||
|
||
// Access properties using a mix of both bracket and dot notaion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: notaion
Other than the one typo, this looks good. |
Fixed typo and landed |
"The simplest way" is to use an object literal. None of us use
new Object
we shouldn't even mention it.