It appears that window.undefined is writable, i.e. it can be set to something else than its default value (which is, unsurprisingly, undefined).
window.undefined
undefined
Actually, comparing anything with undefined is not good idea at all. Should use typeof operator instead:
typeof
function isUndefined ( variant ) { return typeof variant === 'undefined' }