xgqfrms react
e.preventDefault();
e.stopPropagation();
e.nativeEvent.stopImmediatePropagation();
xgqfrms react
e.preventDefault();
e.stopPropagation();
e.nativeEvent.stopImmediatePropagation();
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
Object.keys(obj) / Object.keys(arr)
let abc = {a: "a", b: "b", c: "c"};
console.log(Object.keys(abc));
// (3) ["a", "b", "c"]
let xyz = {x: "xxx", y: "yyy", z: "zzz"};
console.log(Object.keys(xyz));
// (3) ["x", "y", "z"]
// array like object with random key ordering
let anObj = { 100: 'a', 2: 'b', 7: 'c' };
console.log(Object.keys(anObj));
// ['2', '7', '100']
// 类数组 对象, 随机 key 排序
let anObj = { 100: 'a', 2: 'b', 7: 'c' };
console.log(Object.keys(anObj));
// ['2', '7', '100']
/* getFoo 是个不可枚举的属性 */
let my_obj = Object.create(
{},
{
getFoo: {
value: function() {return this.foo;}
}
}
);
my_obj.foo = 1;
console.log(Object.keys(my_obj));
// ["foo"]
console.log(my_obj);
// {foo: 1, getFoo: ƒ}