当前位置:网站首页>JS judge whether the string is empty or not
JS judge whether the string is empty or not
2022-06-28 14:30:00 【Ling er~】
js Judge whether the string is empty or not
1 Judge that the string is empty
var test="";
if(test==""||test==null||test==undefined){
console.log(" It's empty ");// It's empty
}
if(!test){
console.log(" It's empty ");// It's empty
}
2 Judgment string is not empty
var test="1";
if(test!=""&&test!=null&&test!=undefined){
console.log(" Not empty ");// Not empty
}
if(!!test){
console.log(" Not empty ");// Not empty
}
边栏推荐
- Leetcode(665)——非递减数列
- ArcGIS vector center point generates rectangle and cuts TIF image for deep learning sample training
- Opening and closing principle
- What are the products of increased life insurance?
- 外贸邮件推广怎么统计维度
- 解决Unable to create process using ‘D:\Program File
- 机器人的运动范围(DFS)
- PC博物馆-熟悉又陌生的懵懂年代
- Play NAS home NAS server setup scheme "suggestions collection"
- Cat dog queue
猜你喜欢
What is the progress of China open source with 7.55 million developers?
线程终止的 4 种方式
The time schedule for the soft test in the second half of 2022 has been determined!
Reading notes of Mr. toad going to see a psychologist
How to design data visualization platform
PC Museum - familiar and strange ignorant age
Ionq and Ge research confirmed that quantum computing has great potential in risk aggregation
物联网低代码平台常用《组件介绍》
量子前沿英雄谱|“光量子探险家”McMahon:将任何物理系统变成神经网络
A bug liver a week I can't help mentioning issue
随机推荐
2022 questions d'examen pour les cuisiniers chinois (Senior) et l'examen de simulation en ligne
Reverse a stack with recursive functions and stack operations only
【二叉树】在二叉树中分配硬币
PC Museum - familiar and strange ignorant age
Nature | mapping the interaction map of plant foliar flora to establish genotype phenotype relationship
Design a stack with getmin function
开闭原则
Work study management system based on ASP
Differences between ram ROM flash
智联招聘基于 Nebula Graph 的推荐实践分享
Thread life cycle and its methods
【数字IC精品文章收录】近500篇文章|学习路线|基础知识|接口|总线|脚本语言|芯片求职|安全|EDA|工具|低功耗设计|Verilog|低功耗|STA|设计|验证|FPGA|架构|AMBA|书籍|
NPOI导出Excel并下载到客户端
Introduction to common components of IOT low code platform
仅用递归函数和栈操作逆序一个栈
Four methods of thread termination
木兰开放作品许可证1.0面向社会公开征求意见
单一职责原则
Based on asp Net based document retrieval system
由两个栈组成的队列