3 ms·So that the methods don't need to be re-defined for every object.by ww520 15y agoSo that the methods don't need to be re-defined for every object.recursive 15y agoObject literals don't require you to duplicate any code: function getObject(val1, val2) { return { foo: val1, bar: function() { return val2; } }; }stephenr 15y agoIn this instance the "bar" method is redefined every time you call getObject.