Standard built-ins
Symbol()
Creates a fresh symbol. An optional description is converted to a string unless it is undefined; it does not determine identity. Symbol is callable but not constructible. Registered symbols are obtained through Symbol.for instead.
Formal Syntax & Structure
javascript syntaxjavascript
Symbol(description)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| description | any | Optional descriptive label; not a registry key. |
Return Value
symbol
A fresh distinct symbol.
Working Example
Example Snippetjavascript
const token = Symbol("tag");console.log(typeof token);