Re:OO JS in 15mins or Less
by ww520 on Monday April 30, 2012 @12:33PM
(#3909944)
So that the methods don't need to be re-defined for every object.
[ Parent
| on HN ]
Object literals don't require you to duplicate any code:
function getObject(val1, val2) {
return {
foo: val1,
bar: function() {
return val2;
}
};
}