addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcredit-cardcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobe--smallglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1launch-new-window--smalllight-bulblinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

JavaScript KC Message Board › void 0

void 0

Jeremy D.
Kansas City, MO
Post #: 1
You learn something new every day. For so long I've been typing out (typeof(something)==='undefined')

But, today I was browsing the code to PUID (­) and noticed a bunch of references to void 0:

value: options === void 0 ? defaultValue : anotherValue

So, of course, I had to fire up Node and see exactly what this magical void 0 was. Turns out its a undefined reference that works every time.

So, typeof(void 0) returns 'undefined', thus comparison of a variable to void 0 will tell you if it is defined or not.

Just thought I'd pass it on.
Andrew D.
Washington, DC
Post #: 13
Yes! void 0 is preferred by the Coffeescript compiler as well to represent undefined: http://coffeescript.o...­
Powered by mvnForum

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy