This is the code I am testing --
Works fine
document.write( 1 && undefined ); // prints undefined
document.write( 1 && 3 ); // prints 3
document.write( 1 && true ); // prints true
Throws error
document.write( 1 && NULL ); // throws Error
why using NULL throws arror although its working even for undefined
although i tested typeof NULL and its giving undefined but still its not working.let me know about this. (New to OOP programming)
NULL does not exist, try this
try {
document.write( 1 && NULL );
} catch ( e) {
document.write( 1 && null );
}
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