Managing Instance Types with species
Let's discuss the role of symbol species in managing the instance type.
We'll cover the following
We covered the implementation of static property kindHint
for configuring the instance type in the Managing Instance Types Rules lesson. Let’s move onto the symbols in this lesson.
We may create our own symbol, for example, Symbol.for("KINDHINT")
, but there’s already a predefined symbol for this purpose in JavaScript—Symbol.species
.
Symbol.species
Symbol.species
is used to convey the constructor to be used to create derived objects. Let’s modify the SpecializedName
class we implemented in the previous lesson to use species
instead of kindHint
:
Get hands-on with 1400+ tech skills courses.