Understanding boolean types in javascript
Speaking of the Boolean type, I believe anyone who has had programming experience knows what it is. But the Boolean type in Javascript is very interesting.
First of all, it is used to determine whether it is true or false, not just true or false. , it seems that any object can be used as a Boolean judgment. Do you have a sense of accomplishment that "everything in the world is for my use"? I checked it online and copied it from elsewhere and summarized it as follows:
1. All objects are considered is true.
2. A string is considered false if and only if it is empty ("" or '').
3. Null and undefined are considered false.
4. A number is false if and only if it is 0.
So it is very convenient to use. If you want to judge whether there is an object on the page, just use this sentence:
if(button)
{
alert("exist");
}
else
{
alert("SORR\, does not exist");
}
Isn't it very convenient? Using this well can reduce a lot of code for judgment in javascript.
The above is the management of Boolean type content in javascript. For more related articles, please Follow the PHP Chinese website (www.php.cn)!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

