Johannes Baum
Dec 11, 2020

That is correct.

The difference is, that charAt() does not give the syntactical impression of being able to assign a single character. Bracket notation however is known from arrays and can easily be confused to show the same behaviour for strings. In addition an assignment silently fails.

Don't get me wrong. I am not advising against using bracket notation. I only mention the danger of misunderstanding its behaviour.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Johannes Baum
Johannes Baum

Written by Johannes Baum

Creator of GridEngine (https://github.com/Annoraaq/grid-engine) 👾 Software Engineer 🚀 JavaScript/TypeScript

No responses yet

Write a response