Javascript check for undefined quotes

// In Game_Eventtypeof this.page() === undefined // doesn't worktypeof this.page() === 'undefined' // works// also requires quotes around the undefined.(typeof Silv.Minimap.POI[$gameMap._mapId] === 'undefined')// But then in DataManager.onLoad:if (data && data.note !== undefined) // <<<< no quotes! huh?Erm... huh? When to quote undefined?
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/typeof

The typeof operator returns a string indicating the type of the unevaluated operand.
undefined itself is an immutable object residing in the public scope, while 'undefined' is the string representation of its type.
The typeof operator always returns a string. So if you're using it to check the type of something, you need to compare it to 'undefined' (with quotemarks, as it is a string).

When you compare something directly to undefined (without quotemarks, and without using typeof), you're actually just comparing it to a global variable that doesn't exist - one that is undefined. So two undefined things comparing to each other will return true.
use typeof instead or instanceof. If you know how to pull in third party libraries, use lodashes isUndefined function
Oh I see the typeof is what changes everything. Thanks all.

Original thread: https://forums.rpgmakerweb.com/threads/javascript-check-for-undefined-quotes.51301/