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.exportsis same exports 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

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -