how to check undefined or null reference in javascript?
Answer: Use the equality operator ( == ) In JavaScript if a variable has been declared, but has not been assigned a value, is automatically assigned the value undefined . Therefore, if you try to display the value of such variable, the word "undefined" will be displayed.