Files
30-seconds-of-code/snippets/isFunction.md
Angelos Chalaris 611729214a Snippet format update
To match the starter (for the migration)
2019-08-13 10:29:12 +03:00

17 lines
301 B
Markdown

---
title: isFunction
tags: type,function,beginner
---
Checks if the given argument is a function.
Use `typeof` to check if a value is classified as a function primitive.
```js
const isFunction = val => typeof val === 'function';
```
```js
isFunction('x'); // false
isFunction(x => x); // true
```