I am trying to check if a variable is defined or not using the below:
if(variable.obj[0] === undefined){
console.log("yes it's undefined !")
}
and also tried :
if ("undefined" === typeof variable.obj[0]) {
console.log("variable is undefined");
}
However it throws on the console:
Uncaught TypeError: Cannot read property '0' of undefined
at <anonymous>:1:16