4 ms·
Why would it cause a crash? In function createObject(), the `this` reference is bound to the local scope of the node file. You assign a global `obj` handle to
by angersock 11y ago
Why would it cause a crash?
In function createObject(), the `this` reference is bound to the local scope of the node file. You assign a global `obj` handle to that reference when it is returned from the invocation of `createObject`. You then compare (not write!) 3 with a nonexistent property (undefined) on that reference.
Why would that cause a crash?
Git gud, as the kids say these days.
Maybe do some reading:
http://stackoverflow.com/questions/27031663/default-binding-of-this-is-different-from-chrome-browser-and-node-js http://stackoverflow.com/questions/27031663/default-binding-...
EDIT:
Node and Javascript have all kinds of other problems, but if you take a second to learn about how things like `this` are handled in the language, you won't be nearly as surprised later.