Is it possible to load a code constructor in js?

    1 answer 1

    Can

    var Constructor = function () { // нагружаем как хотим. // Объект, созданный при помощи оператора new, доступен через this. // http://learn.javascript.ru/object-methods } var instance = new Constructor(); 
    • About new and this. It may be worth mentioning the self-calling constructor pattern, and, accordingly, the only difference between the constructor and the function is the capital letter at the beginning ... function Constructor () {if (this instanceof Constructor) {this.property = "bubble"; } else {return new Constructor (); }} - moron
    • @moron, then it’s already necessary to redirect to Stefan Stoyanov . - alvoro