当前位置:网站首页>for in 与Object.keys()的区别
for in 与Object.keys()的区别
2022-06-12 11:59:00 【mustang(野马)】
for in 与Object.keys()的区别
function Person(name, age) {
this.name = name;
this.age = age;
}
Person.prototype = {
sex: "男"
}
var man = new Person("张三", 18);
console.log(Object.keys(man));//["name","age"]
for (var key in man) {
console.log(key);//name age sex
}
总结:
// Object.keys():返回一个数组,数组值为对象自有的属性,不会包括继承原型的属性
//
// for in :遍历对象可枚举属性,包括自身属性,以及继承自原型的属性
边栏推荐
- Lambda and filter, index of list and numpy array, as well as various distance metrics, concatenated array and distinction between axis=0 and axis=1
- ARP protocol data processing process of neighbor subsystem
- PIP install in the CONDA environment cannot be installed into the specified CONDA environment (the default PIP installation location of the CONDA environment)
- Inter class and intra class relations in video classification -- regularization
- Load/store instruction addressing mode of arm instruction set (1)
- Jump instruction of arm instruction set
- 邻居子系统之邻居项状态更新
- Face recognition PIP failed to install Dlib Library
- 6.6 分離卷積
- 标品和非标品如何选品,选品的重要性,店铺怎样布局
猜你喜欢

Create servlet project

6.6 Convolution de séparation

QT based travel query and simulation system

Compiling Draco library on Windows platform

UML系列文章(30)体系结构建模---制品图

Longest string without duplicate characters (leetcode 3)

ARM处理器模式与寄存器

Lambda and filter, List 和 numpy array的索引,以及各种距离指标distance-metrics,拼接数组以及axis=0 and axis=1的区分

LeetCode 497. 非重叠矩形中的随机点(前缀和+二分)

5G NR協議學習--TS38.211下行通道
随机推荐
Pytoch notes
Cookie和Session
Channel Shuffle类
A.前缀极差
First understand the onion model, analyze the implementation process of middleware, and analyze the source code of KOA Middleware
LeetCode 497. Random points in non overlapping rectangles (prefix and + bisection)
Load/store instruction addressing mode of arm instruction set (2)
必杀技--使用FFmpeg命令快速精准剪切视频
ARM指令集之数据处理指令寻址方式
Spark common encapsulation classes
Tpage design
UML系列文章(31)体系结构建模---部署图
NVIDIA Jetson Nano Developer Kit 入门
Socket implements TCP communication flow
视频分类的类间和类内关系——正则化
Reentrantlock source code analysis
ARM指令集之Load/Store指令寻址方式(二)
PDSCH 相关
转载--win10打开任务管理器就蓝屏的问题
QML学习 第二天