首页 > 代码库 > ECMAScript6新特性之Reflect

ECMAScript6新特性之Reflect

Reflect.ownKeys()

let fruit = {
    ‘2‘ : ‘mango‘,
    [Symbol.for(‘pink‘)] : ‘peach‘,
    ‘red‘ : ‘apple‘,
    ‘yellow‘ : ‘banana‘,
    [Symbol.for(‘purple‘)] : ‘grape‘,
    ‘1‘ : ‘Litchi‘
};
console.log(‘Reflect.ownKeys‘,Reflect.ownKeys(fruit));
console.log(‘Object.getOwnPropertyNames‘,Object.getOwnPropertyNames(fruit));
console.log(‘Object.getOwnPropertySymbols‘,Object.getOwnPropertySymbols(fruit));
console.log(Object.getOwnPropertyNames(fruit).concat(Object.getOwnPropertySymbols(fruit)));

 

ECMAScript6新特性之Reflect