DEV Community

Discussion on: Why does this work in javascript?

Collapse
 
vkbr profile image
Vivek B

Index(es) needs to be string and JS will automatically convert anything used as object's index to a string. ['b'].toString() happens to be equal to 'b' (its same as ['b'].join(',')).

Collapse
 
sobiodarlington profile image
Sobio Darlington

Looks like it.