typescript常用操作
Easul Lv6

方法

获取一个对象的所有键

TYPESCRIPT
1
2
3
4
5
6
// 获取的所有键是一个数组
const testJson = {
firstKey: 1,
secondKey: 'hello'
}
console.log(Object.keys(testjson))

获取一个对象的所有值

TYPESCRIPT
1
2
3
4
5
6
// 获取的所有值是一个数组
const testJson = {
firstKey: 1,
secondKey: 'hello'
}
console.log(Object.values(testjson))
 评论