0

What is the best way of checking if an object property in JavaScript is undefined?

JavaScript
if (typeof variable === "undefined") {
    console.log("variable is undefined");
}

var variable = 'value';
console.log(typeof variable === "undefined"); // false
RUN
add comment
Suggest a different solution or add another example