I have declared an array a = [1,2,3,4,5]
a = [1,2,3,4,5]
When I write a[1] it returns 2 which is perfectly fine but when I write a[\'1\']
a[1]
a[\'1\']
All property names are strings.
If you pass a number, it gets converted to a string before being used to look up the property value.
console.log(1 == '1');