当前位置:网站首页>Object.getOwnPropertyNames() VS Object.keys()
Object.getOwnPropertyNames() VS Object.keys()
2022-07-26 20:31:00 【紫微前端】
差异
Object.getOwnPropertyNames(obj)返回对象的所有属性obj。Object.keys(obj)返回所有 可枚举的属性。除非您设置enumerable: false为任何属性,否则它们会提供相同的结果。在以下示例中,该screen对象具有两个属性,branch并且size.
const screen = {
branch: 'Dell',
size: '27inch',
};
Object.getOwnPropertyNames(screen); // ['branch', 'size']
Object.keys(screen); // ['branch', 'size']让我们再定义一个名为的属性resolution,但它被设置为enumerable: false:
Object.defineProperties(screen, {
resolution: {
enumerable: false,
v边栏推荐
猜你喜欢

今天公司碰到一个阿里p8,算是真正见识到了基础的天花板

4年软件测试工作经验,跳槽之后面试20余家公司的总结

SPI configuration

手机\固定电话座机呼叫转移设置方法

09_ UE4 advanced_ Enter the next level and reserve the blood volume

腾讯为什么没能造创造出《原神》这样的游戏

Difference between redis hash and string

How to configure the legendary SF lander to automatically read the list without a network

串口通信失败

JDBC connection
随机推荐
Remember the idea of solving the problem of invalid bound statement xxxxx once
Niuke brush questions - MySQL series
Web3.0 时代,基于P2PDB实现一款Dapp的技术理论
Difference between redis hash and string
Retrieve the parameters in this method in idea for our use -- 1. Class diagram. 2. Double click shift
服务器的防护会遇到什么样的安全问题呢?
一些意想不到的bug记录
Flutter性能优化实践 —— UI篇
Flash source code outline
Registration conditions for information system project managers in the second half of 2022 (soft examination advanced)
详解西部数据SMR叠瓦式硬盘的190二级编译器(译码表)模块
Why does it system need observability?
银河证券场内基金低佣金开户靠谱吗,可靠安全吗
HTTP cache browser cache that rabbits can understand
Redis hash和string的区别
Monitor MySQL based on MySQL exporter
idea中debug时如何进入指定的用户方法体中?
js中join方法
[hcie security] dual computer hot standby - primary and standby backup
Why didn't Tencent create a game like "original God"