Created
December 1, 2013 04:21
-
-
Save nola/7728448 to your computer and use it in GitHub Desktop.
propNameOrNumber in objectName
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Arrays | |
| var trees = new Array("redwood", "bay", "cedar", "oak", "maple"); | |
| 0 in trees; // returns true | |
| 3 in trees; // returns true | |
| 6 in trees; // returns false | |
| "bay" in trees; // returns false (you must specify the index number, | |
| // not the value at that index) | |
| "length" in trees; // returns true (length is an Array property) | |
| // Predefined objects | |
| "PI" in Math; // returns true | |
| var myString = new String("coral"); | |
| "length" in myString; // returns true | |
| // Custom objects | |
| var mycar = {make: "Honda", model: "Accord", year: 1998}; | |
| "make" in mycar; // returns true | |
| "model" in mycar; // returns true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment