const obj = {
15: 100
};
for(let key in obj)
console.log(key, typeof(key), typeof(+key))
The result is 15 string number
. I'm trying to iterate over object values and put some of them into Map object but types compatibility seems unable to achieve. Am I doing something wrong here or object keys are always strings?
Object.keys(obj)
also returns ["15"]