What is the difference between str[0]
and str.charAt(0)
? I always access specific character by simply typing str[i]
, where i
is the index of the character I want to access (counted from 0), but last week I had good overview of open source JS code, and in every single project I saw, people use charAt
method.
Is there any difference between those two ways?