javascript - Is there any way to use a numeric type as an object key? - Stack Overflow

PHOTO EMBED

Sun Oct 23 2022 15:46:17 GMT+0000 (Coordinated Universal Time)

Saved by @arielvol

const screens = {
    "768": "large",
    "200": "small"
}

const keys = Object.keys(screens).map(key => parseInt(key))
                                         // OR Number(key)

console.log(keys) // Output [200, 768]
content_copyCOPY

https://stackoverflow.com/questions/3633362/is-there-any-way-to-use-a-numeric-type-as-an-object-key