Nest all content into snippets
This commit is contained in:
20
snippets/js/s/is-symbol.md
Normal file
20
snippets/js/s/is-symbol.md
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
title: Value is symbol
|
||||
type: snippet
|
||||
language: javascript
|
||||
tags: [type]
|
||||
cover: naming-conventions
|
||||
dateModified: 2020-09-15T16:28:04+03:00
|
||||
---
|
||||
|
||||
Checks if the given argument is a symbol.
|
||||
|
||||
- Use `typeof` to check if a value is classified as a symbol primitive.
|
||||
|
||||
```js
|
||||
const isSymbol = val => typeof val === 'symbol';
|
||||
```
|
||||
|
||||
```js
|
||||
isSymbol(Symbol('x')); // true
|
||||
```
|
||||
Reference in New Issue
Block a user