⭐computed property name
🚧 under construction
JS ⟩ values ⟩ object ⟩ property ⟩ name ⟩ computed
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 make-iterator method of an iterable object is a computed property name (i.e. [Symbol.iterator]).
let p = {
[`p${1}`]: 1, // ⭐️ computed property name:
['p' + 2]: 2, // any JS expression in [ ... ]
};
p.p1 + p.p2 // 3❓ 問題: " What is a computed property name for❓"
💡 答案:
for some special method names (e.g. make-iterator method name for an iterable)
Last updated
Was this helpful?