Skip to content

Instantly share code, notes, and snippets.

@nola
Created December 1, 2013 04:21
Show Gist options
  • Select an option

  • Save nola/7728448 to your computer and use it in GitHub Desktop.

Select an option

Save nola/7728448 to your computer and use it in GitHub Desktop.
propNameOrNumber in objectName
// 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