Javascript Object.keys( ) method

Want to get all keys present in an object?

Try Object.keys( )

Usecase:

let obj = {
    year: 2019,
    month: 'september'
}

const objKeys = Object.keys(obj);            

console.log(objKeys);

// [ 'year', 'month' ]

Enter fullscreen mode Exit fullscreen mode

原文链接:Javascript Object.keys( ) method

© 版权声明
THE END
喜欢就支持一下吧
点赞6 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容