Bracket Notation
noun
say it: “BRAK-it noh-TAY-shun” /ˈbrækɪt noʊˈteɪʃən/
Reading or changing a property of a JavaScript object by putting its name, as text or a variable, in square brackets, such as pet['species'] or pet[field].
What is Bracket Notation in JavaScript?
Bracket Notation — Accessing an object property with a key expression inside square brackets.
const order = { item: "tea" };
const key = "item";
const item = order[key];
In a sentence
- “The user picked which column to sort by, so I read it with bracket notation: pet[field].”
Level: Apprentice · More JavaScript terms at this level
Updated