Created
April 18, 2012 23:19
Minimum JS - Classes 1
This file contains 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
// The quick and dirty way | |
var baby1 = { | |
name: "cutesy", | |
sex: "F", | |
speak: function() { | |
return "gaga"; // As in Lady | |
} | |
}; | |
// Functionally equivalent to this... | |
var baby1 = {}; // Or, even new Object(); | |
baby1.name = "cutesy"; | |
baby1["sex"] = "F"; // Notice what I did there? | |
baby1.speak = function() { | |
return "gaga"; // Still, as in Lady. | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment