javascript - Instance Creation ( JS ) -
javascript - Instance Creation ( JS ) -
i've been reading substack modules , notice style of creating new instace of object.
if (!(this instanceof browserify)) homecoming new browserify(files, opts);
https://github.com/substack/node-browserify/blob/master/index.js#l37
i know this
in "this" particular case refers window obj, , browserify wont instance of (window).
my question : thoughts way or style creating object ? / convenient way of instantiating object without having do. var brows = require('browserify')
, var x = new brows()
effectively prevents calling constructor without returning instance of object, or eliminates need utilize new
keyword. next same thing:
var brs = new browserify(); var brs = browserify();
brs
instantiated browserify
object either way.
as why or necessary -- think matter of sentiment more else.
javascript node.js browserify
Comments
Post a Comment