当前位置:网站首页>js判断对象是否为空
js判断对象是否为空
2022-07-02 06:23:00 【xuefankang】
1、es6中可以使用Object.keys(obj)
var obj= {};
var arr = Object.keys(obj);
alert(arr.length == 0); //true 为空, false 不为空
2、将json对象转化为json字符串,再判断该字符串是否为"{}"
var obj= {};
var b = (JSON.stringify(obj) == "{}");
alert(b); //true 为空, false 不为空
边栏推荐
- CUDA and Direct3D consistency
- The intern left a big hole when he ran away and made two online problems, which made me miserable
- Sentry搭建和使用
- Self study table Au
- Three suggestions for all students who have graduated and will graduate
- The table component specifies the concatenation parallel method
- Win电脑截图黑屏解决办法
- Common function writing method and set get writing method for calculating attributes
- Distributed transactions: the final consistency scheme of reliable messages
- Unexpected inconsistency caused by abnormal power failure; Run fsck manually problem resolved
猜你喜欢
华为MindSpore开源实习机试题
PgSQL学习笔记
查询GPU时无进程运行,但是显存却被占用了
Sublime Text 配置php编译环境
Latex error: the font size command \normalsize is not defined problem solved
Code skills - Controller Parameter annotation @requestparam
table 组件指定列合并行方法
Detailed definition of tensorrt data format
Alibaba cloud MFA binding Chrome browser
实现strStr() II
随机推荐
pytest(3)parametrize参数化
Nodejs - Express middleware modification header: typeerror [err_invalid_char]: invalid character in header content
Selenium+msedgedriver+edge browser installation driver pit
There are multiple good constructors and room will problem
Latex compiles Chinese in vscode and solves the problem of using Chinese path
PIP install
Fe - wechat applet - Bluetooth ble development research and use
Latex warning: citation "*****" on page y undefined on input line*
Vector types and variables built in CUDA
ZZQ的博客目录--更新于20210601
Fe - eggjs combined with typeorm cannot connect to the database
Linux MySQL 5.6.51 community generic installation tutorial
Sparse array (nonlinear structure)
ModuleNotFoundError: No module named ‘jieba. analyse‘; ‘ jieba‘ is not a package
计算属性普通函数写法 和 set get 写法
Kotlin - 验证时间格式是否是 yyyy-MM-dd HH:mm:ss
Win10:添加或者删除开机启动项,在开机启动项中添加在用户自定义的启动文件
js的防抖和节流
selenium的web自动化中常用的js-修改元素属性翻页
Summary of advertisement business bug replay