const first= {a: 2, b: 3}const second= {"a": 2, "b": 3}
Even though both examples given above print the same in console, I can't access the values of those objects the same way. To access the key of first object, I have to write console.log( first.a ) and for second object console.log( first[a] ).
So if they are printing the same, why should I have to access them in different way. If the keys in first object aren't characters then what are they...
Below code is the reason why I got this question
const maxchar = (str)=>{
let charCount = {}
for (let index = 0; index < str.length; index++) {
const char = str[index]
charCount[char] = charCount[char]+ 1|| 1 //can't access char as charCount.char
}
return charCount
}