I need to check if a object "objCR" is present in the current scope or not. I tried using below code.
if(objCR == null)
alert("object is not defined");
Let me know where I am wrong.
Use the typeof
operator:
if(typeof objCR == "undefined")
alert("objCR is not defined");
if (typeof objCR=="undefined"){
alert("objCR is undefined");
} else {
alert("objCR is defined");
};
(!objCR)
will return true if objCR
is a boolean equal to false
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