Is there any reason I should use string.charAt(x) instead of the bracket notation string[x]?
From MDN:
There are two ways to access an individual character in a string. The first is the charAt method, part of ECMAScript 3:
return 'cat'.charAt(1); // returns "a"The other way is to treat the string as an array-like object, where each individual characters correspond to a numerical index. This has been supported by most browsers since their first version, except for IE. It was standardised in ECMAScript 5:
return 'cat'[1]; // returns "a"The second way requires ECMAScript 5 support (and not supported in some older browsers).
In both cases, attempting to change an individual character won't work, as strings are immutable, i.e., their properties are neither neither "writable" nor "configurable".
str.charAt(i) is better from a compatibility perspective if IE6/IE7 compatibility is required.str[i] is more modern and works in IE8+ and all other browsers (all Edge/Firefox/Chrome, Safari 2+, all iOS/Android).