Skip to main content
Version: 1.3.0

isSymbol

Using

This function determines whether the given value is a symbol primitive.

  • Returns true only if the value is of type symbol (e.g., Symbol(), Symbol.iterator, Symbol.for()).
  • Returns false for all other types, including boxed symbols (e.g., Object(Symbol()), new Symbol()).

Arguments

ArgumentTypeDescriptionExample
valueunknownCan be any type"text"
2
undefined

Returns

booleantrue if value is a symbol primitive, false otherwise

Examples

isSymbol(Symbol());
// true

isSymbol(Symbol.iterator);
// true

isSymbol(Symbol.for('key'));
// true

isSymbol('symbol');
// false

isSymbol(Object(Symbol()));
// false

isSymbol(new Symbol());
// false

isSymbol(() => Symbol());
// false

Resources

📦 Since:1.3.0
📦 Last updated:1.3.0
📦 Available in:1.3.0