Object.keys几种使用方法
一、处理对象,返回可枚举的属性数组
let person = {name:“张三”,age:26,address:“广州”,getPhone:function(){}}
Object.keys(person) // [“name”, “age”, “address”,“getPhone”]
二、处理数组,返回索引值数组
let arr = [1,2,3,4,5,6]
Object.keys(arr) // [“0”, “1”, “2”, “3”, “4”, “5”]
三、处理字符串,返回索引值数组
let
原创
2020-07-23 10:21:54 ·
371 阅读 ·
0 评论