So I was playing around with the Node.js REPL and the Underscore library when I noticed something very strange. If I require("underscore")
, the variable _
is set globally (obviously). Then when I attempt to run a simple command like console.log(_.isEmpty)
it prints [Function]
(again, obviously). However, upon running console.log(_)
right after, it prints [Function]
because the variable _
was set to _.isEmpty
.
Why does this do this? If I run the same code from a js file this doesn't happen. Is this a normal Node thing or is this a total bug?
FYI: Node v0.10.10