当前位置:网站首页>JS judge whether the object is empty
JS judge whether the object is empty
2022-07-02 06:50:00 【xuefankang】
1、es6 Can be used in Object.keys(obj)
var obj= {};
var arr = Object.keys(obj);
alert(arr.length == 0); //true It's empty , false Not empty
2、 take json Object to json character string , Then judge whether the string is "{}"
var obj= {};
var b = (JSON.stringify(obj) == "{}");
alert(b); //true It's empty , false Not empty
边栏推荐
- Dynamic global memory allocation and operation in CUDA
- ZZQ的博客目录--更新于20210601
- Selenium+msedgedriver+edge browser installation driver pit
- The win10 network icon disappears, and the network icon turns gray. Open the network and set the flash back to solve the problem
- Queue (linear structure)
- Loops in tensorrt
- Functions of tensorrt
- 2020-9-23 use of QT timer qtimer class.
- 20210306 reprint how to make TextEdit have background pictures
- The default Google browser cannot open the link (clicking the hyperlink does not respond)
猜你喜欢
unittest.TextTestRunner不生成txt测试报告
uniapp引入本地字体
Idea announced a new default UI, which is too refreshing (including the application link)
How to debug wechat built-in browser applications (enterprise number, official account, subscription number)
Pytest (1) case collection rules
CTF three count
Recursion (maze problem, Queen 8 problem)
QQ email cannot receive the email sent by Jenkins using email extension after construction (timestamp or auth...)
Win10:添加或者删除开机启动项,在开机启动项中添加在用户自定义的启动文件
Utilisation de la carte et de foreach dans JS
随机推荐
查询GPU时无进程运行,但是显存却被占用了
Blog directory of zzq -- updated on 20210601
ModuleNotFoundError: No module named ‘jieba. analyse‘; ‘ jieba‘ is not a package
ctf-web之练习赛
selenium备忘录:selenium\webdriver\remote\remote_connection.py:374: ResourceWarning: unclosed<xxxx>解决办法
Présence d'une panne de courant anormale; Problème de gestion de la fsck d'exécution résolu
2020-9-23 QT的定时器Qtimer类的使用。
奇葩pip install
Recursion (maze problem, Queen 8 problem)
PIP install
Pytest (3) parameterize
20201002 VS 2019 QT5.14 开发的程序打包
Alibaba cloud MFA binding Chrome browser
Sentinel rules persist to Nacos
Loops in tensorrt
DeprecationWarning: . ix is deprecated. Please use. loc for label based indexing or. iloc for positi
Thread hierarchy in CUDA
js删除字符串的最后一位
js判断数组中对象是否存在某个值
Promise中有resolve和无resolve的代码执行顺序