Home > Web Front-end > JS Tutorial > Three implementation methods to determine whether an object is empty in js_javascript skills

Three implementation methods to determine whether an object is empty in js_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 17:07:42
Original
1085 people have browsed it

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Where is js written?
From 1970-01-01 08:00:00
0
0
0
js addClass not working
From 1970-01-01 08:00:00
0
0
0
js file code not found
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template