view core-javascript/core-javascript-work/library.js @ 161:a4b0e283999c core-javascript.closure-exercises

Have remove_answers.py process all js files in the answers folder.
author jf3243
date Wed, 09 Nov 2011 16:10:29 +0000
parents b774913eb242
children
line wrap: on
line source

// start create
var create = function(parent){

    var tmp = function(){};
    tmp.prototype = parent;
    var child = new tmp();

    return child;
};
// end create


// start SimpleClass
var SimpleClass = function(prototype){

    var cls = function(){

        var instance = create(prototype);
        instance.__init__.apply(instance, arguments);
        return instance;
    };

    return cls;
};
// end SimpleClass