if(typeof window !== undefined) {
console.log("this should print only if window object actually exists")
}
Can somebody tell me why NodeJS (0.6.5) is not working correctly when checking if window is not defined? If you call typeof window, you get undefined but still condition above fails to work. Any ideas?
if(typeof window !== 'undefined') {
console.log("this should print only if window object actually exists")
}
typeof returns a string
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With