Skip to content

Instantly share code, notes, and snippets.

@jgable
Created April 18, 2012 23:19
Minimum JS - Classes 1
// 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