const obj = {
true: 'a',
['true']: 'b',
[true]: 'c',
};
const result = Object.keys(obj).length;
What happens?
const foo = 'bar';
const obj = {
foo: 'a',
[foo]: 'b',
};
const result = obj.foo;
What happens?
const foo = 'bar';
const obj = {
foo: 'a',
[foo]: 'b',
};
const result = obj.bar;
What happens?
const foo = 'bar';
const obj = {
foo: 'a',
[foo]: 'b',
};
const result = obj[foo];
What happens?
const foo = 'bar';
const obj = {
foo: 'a',
[foo]: 'b',
};
const result = obj[bar];
What happens?
const foo = 'bar';
const obj = {
foo: 'a',
[foo]: 'b',
};
const result = obj['foo'];
What happens?
const foo = 'bar';
const obj = {
foo: 'a',
[foo]: 'b',
};
const result = obj['bar'];
What happens?
const symbol1 = Symbol('symbol1');
const symbol2 = Symbol('symbol2');
const obj = {
name1: 0,
[symbol1]: 0,
};
Object.defineProperties(obj, {
name2: { enumerable: false, value: 0 },
[symbol2]: { enumerable: false, value: 0 },
});
const result = Object.keys(obj);
What is the result?
const symbol1 = Symbol('symbol1');
const symbol2 = Symbol('symbol2');
const obj = {
name1: 0,
[symbol1]: 0,
};
Object.defineProperties(obj, {
name2: { enumerable: false, value: 0 },
[symbol2]: { enumerable: false, value: 0 },
});
const result = Reflect.ownKeys(obj);
What is the result?
const symbol1 = Symbol('symbol1');
const symbol2 = Symbol('symbol2');
const obj = {
name1: 0,
[symbol1]: 0,
};
Object.defineProperties(obj, {
name2: { enumerable: false, value: 0 },
[symbol2]: { enumerable: false, value: 0 },
});
const result = Object.getOwnPropertyNames(obj);
What is the result?
const symbol1 = Symbol('symbol1');
const symbol2 = Symbol('symbol2');
const obj = {
name1: 0,
[symbol1]: 0,
};
Object.defineProperties(obj, {
name2: { enumerable: false, value: 0 },
[symbol2]: { enumerable: false, value: 0 },
});
const result = Object.getOwnPropertySymbols(obj);
What is the result?
const jane = {
name: 'Jane',
hello() {
return `Hello ${this.name}!`;
},
};
const func = jane.hello;
Which of these way of calling obj.hello
work?