27 lines
565 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
``++Symbol++`` is a primitive type introduced in ECMAScript2015. Its instances are mainly used as unique property keys.
An instance can only be created by using ``++Symbol++`` as a function. Using ``++Symbol++`` with the ``++new++`` operator will raise a ``++TypeError++``.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
const sym = new Symbol("foo"); // Noncompliant
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
----
const sym = Symbol("foo");
----
ifdef::rspecator-view[]
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::rspecator-view[]