Object方法
作者:互联网
Object.keys()返回键
1.处理对象,返回键
let person = {name:"张三",age:25,address:"深圳",getName:function(){}}
Object.keys(person) // ["name", "age", "address","getName"]
2.处理数组,返回字符串数组索引
let arr = [1,2,3,4,5,6]
Object.keys(arr) // ["0", "1", "2", "3", "4", "5"]
3.处理字符串,返回字符串数组索引
let str = "12345字符串"
Object.keys(str) // ["0", "1", "2", "3", "4", "5", "6", "7"]
Object.values()返回值
Object.entries()返回键值对
标签:返回,keys,Object,let,数组,字符串,方法 来源: https://www.cnblogs.com/ljh980217/p/16626550.html