Home >Web Front-end >JS Tutorial >How to determine whether a character is empty in javascript
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.
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; } }
js call:
if (!IsEmpty(value)) { alert(value); }
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!