I don't recollect exactly what its called but php checks and exists as soon as it finds one false value in a function, like so :
// php
if(isset(a["hi"]) && isset(a["hi"]["hello"])) {
}
here if a["hi"]
is not set, it will not bother to check the next a["hi"]["hello"]
.
to check something like this in javascript you'd need to nest
// js
if(typeof(a["hi"]) != "undefined") {
if(typeof(a["hi"]["hello"]) != "undefined") {
}
}
Can we do php style lazy checking in javascript? (I may not be using the best method to check if an element exists in a multi-dimentional array, if there is a succinct way of doing this, would love to know.)
thanks!