03 2024 档案

摘要:将对象转换成字符串,再判断是否为空串 let obj={}; console.log(JSON.stringify(obj) "{}"); // 返回 true for in 循环 let result=function(obj){ for(let key in obj){ return false 阅读全文
posted @ 2024-03-07 22:30 yhstsy 阅读(1339) 评论(0) 推荐(0) 编辑
摘要:一、判断值是否是对象: toString 方法【常用】 Object.prototype.toString.call(val) '[object Object]' // true 表示为对象 // 这里使用 call 方法改变作用域 constructor 方式 val?.constructor O 阅读全文
posted @ 2024-03-07 20:42 yhstsy 阅读(605) 评论(0) 推荐(0) 编辑
摘要:var arr=[1,1,'true','true',true,true,15,15,false,false,undefined,undefined,null,null,NaN,NaN,'NaN',0,0,'a','a',{},{}] 利用 Set(ES6中最常用) function useSet( 阅读全文
posted @ 2024-03-07 19:17 yhstsy 阅读(830) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示