🚧 under construction
Last updated 2 years ago
Was this helpful?
JS ⟩ values ⟩ object ⟩ property ⟩ name ⟩ computed
⭐️ ES6 (2015)
🚧
it's the name of the property that is computed, not the value of the property.
don't confuse with a computed property in Swift, which is the value of the property that is computed.
use bracket notation [] to compute the property name.
member. (what's this?) 🚧
object property
the name of the of an object is a computed property name (i.e. []).
let p = { [`p${1}`]: 1, // ⭐️ computed property name: ['p' + 2]: 2, // any JS expression in [ ... ] };
JS.info ⟩ computed names
JavaScript: The Definitive Guide ⟩
6.3.1 Objects As Associative Arrays
6.10.2 Computed Property Names
❓ 問題: " What is a computed property name for❓"
💡 答案:
for some special method names (e.g. name for an )