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

vb.net - Alternative to the T-SQL AS keyword -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

ios - CFRelease causing crash in iPad application -