You can use typeof
, like this:
if (typeof something != "undefined") {
// ...
}
if (typeof myVar !== "undefined") {
function_call();
}
November 25, 2021 in Tips and Tricks
You can use typeof
, like this:
if (typeof something != "undefined") {
// ...
}
if (typeof myVar !== "undefined") {
function_call();
}