Home > Article > Web Front-end > Three implementation methods to determine whether an object is empty in js_javascript skills
When writing js scripts, we often encounter situations where the object is empty or not an object. In this case, we can use if to judge it, and then execute the corresponding processing method. The specific methods to judge them are as follows: :
1. if (typeOf(x) == "undefined")
2. if (typeOf(x) != "object")
3. if(!x)
The third method is the simplest method, but the third method cannot be judged by the mutually exclusive method if (x). It can only be added in front of the object!
In java! When x is true, x must be false, but this is not allowed here