Check if a variable is in the scope or not in Javascript

javascript

Solution

Use the `typeof` operator:

if(typeof objCR == "undefined")
   alert("objCR is not defined");

Problem

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.

Original source