check if a variable is undefined jquery 1

check if a variable is undefined jquery

if (typeof value === "undefined") {
    // ...
}

Here is what the above code is Doing:
1. We’re checking if the value is undefined.
2. If it is, we’re going to do something.

The code above is a bit verbose. We can shorten it by using the logical NOT operator (!).

The logical NOT operator (!) will return true if the value to its right is false, and false if the value to its right is true.

We can use the NOT operator to check if a value is undefined like this:

Similar Posts