Joe Honton
Feb 9, 2022

--

Wow, this is a real eye-opener. Thanks for the deep dive.

This is not what I thought was going to happen:

const testObj = {}

testObj[-1.5] = ''

testObj[-1] = ''

testObj[-0.5] = ''

testObj[0] = ''

testObj[0.5] = ''

testObj[1] = ''

testObj[1.5] = ''

console.log(Object.keys(testObj))

(7) ['0', '1', '-1.5', '-1', '-0.5', '0.5', '1.5']

AND it doesn't matter if the property names start out as Strings or Numbers!

--

--

Joe Honton
Joe Honton

Written by Joe Honton

Princeps geographus, Read Write Tools

No responses yet