littlecodeguy

曲中作樂,以曲為生

Javascript 入門:Object.keys() vs Object.getOwnPropertyNames()

一般情況用 Object.keys 就可以滿足到返回自定義 property names,但有時...

一般情況用 Object.keys 就可以滿足到返回自定義 property names,但有時你想得到所有 inherited 嘅 property 比如 Array.prototype.length, Object.keys 就滿足唔到,又或者 object 本身有 define 咗 non-enumerable property。

https://littlecodeguy.com/post/2022-07-07-civil-service-pay-rise/

CC BY-NC-ND 2.0

Like my work?
Don't forget to support or like, so I know you are with me..

Want to read more ?

Login with one click and join the most diverse creator community.