I have a particular if statement that could be written in different ways, and I'm curious as to whether there's any significant difference in readability that I should prefer one over the other:The flow can be boiled down toif string does not begin with '_'    do stuffelse    throw errorSome different ways of writing the if condition:str[0] !== '_'str.indexOf('_')!/^_/.test(str)/^[^_]/.test(str)
poh-tay-toh poh-tah-toh, does writing the same code a different way affect readability?
javascript
I think the first is the simplest and the most readable one from the list but I'd prefer the charAt function:x.charAt(0) !== '_'Furthermore, I'd reverse the condition:if string begins with '_' {    throw error}do stuffReference: How to get first character of string?Flattening Arrow Code