javascript - Why doesn't backbone use module.exports? -
it looks uses plain
exports
instead of module.exports
in line here.
if (typeof exports !== 'undefined') { backbone = exports;
however tutorial shows module.exports
being used.
why doesn't backbone use module.exports?
because doesn't have to. exports
, module.exports
refer same object:
in particular
module.exports
is sameexports
object.
if can save couple of characters type, why not it?
you doing same when use document.getelementbyid
instead of window.document.getelementbyid
. it's more type , doesn't add benefit.
in tutorial using module.exports
because want show difference between exporting symbol why exports
, i.e.
exports.foo = bar;
and overwriting exports
object
module.exports = bar;
for have to use module.exports
(exports = bar;
not work).
Comments
Post a Comment