DEV Community

Discussion on: πŸš€ 26 Built-in String Methods | JavaScript

Collapse
 
jonrandy profile image
Jon Randy πŸŽ–οΈ

Shortcut for charAt:

"Hello world!"[7]    // returns 'o'

Slight difference with an out of range index though - it will return undefined

Collapse
 
nialljoemaher profile image
Niall Maher

Thanks! I'll update it. πŸ’œ
Must be the REPL I ran it in because I ran all the code too and pasted the outputs.

Collapse
 
nialljoemaher profile image
Niall Maher • Edited

I misread it when I was out I now see what you're saying. πŸ€¦β€β™‚οΈ Nice trick! πŸ’œ