News for hackers. Stuff that matters.
Re:OO JS in 15mins or Less by recursive on Monday April 30, 2012 @01:57PM (#3910422)
Object literals don't require you to duplicate any code:

    function getObject(val1, val2) {
        return {
            foo: val1,
            bar: function() {
                return val2;
            }
        };
    }
Re:OO JS in 15mins or Less by stephenr on Tuesday May 01, 2012 @02:29AM (#3913280)
In this instance the "bar" method is redefined every time you call getObject.