Files
30-seconds-of-code/snippets/isSymbol.md
2020-09-15 21:52:00 +03:00

262 B

title, tags
title tags
isSymbol type,beginner

Checks if the given argument is a symbol.

  • Use typeof to check if a value is classified as a symbol primitive.
const isSymbol = val => typeof val === 'symbol';
isSymbol(Symbol('x')); // true