I have this object:
const someobj = {
100: 'a',
200: 'b',
300: 'c'
}
for (const prop in someobj) {
console.log(prop)
console.log({ prop: prop })
}
When running it i get this output:
100
{ prop: '100' }
200
{ prop: '200' }
300
{ prop: '300' }
Why are the prop values converted from a number to a string? Is there anyway to avoid this besides doing Number(prop)
?