Home > Web Front-end > JS Tutorial > body text

How to determine whether a character is empty in javascript

coldplay.xixi
Release: 2023-01-04 09:35:35
Original
3867 people have browsed it

Javascript method to determine whether a character is empty: first determine whether a character is empty, the code is [if(typeof res== "undefined" || res== null || res== "")]; Then call it through js.

How to determine whether a character is empty in javascript

The operating environment of this tutorial: Windows 7 system, JavaScript version 1.8.5, DELL G3 computer.

Javascript method to determine whether a character is empty:

js code:

//判断字符是否为空的方法
function IsEmpty(res){
    if(typeof res== "undefined" || res== null || res== ""){
        return true;
    }else{
        return false;
    }
}
Copy after login

js call:

if (!IsEmpty(value)) {
    alert(value);
}
Copy after login

Related free learning recommendations: javascript(Video)

The above is the detailed content of How to determine whether a character is empty in javascript. For more information, please follow other related articles on the PHP Chinese website!

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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template