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

301 B

title, tags
title tags
isFunction type,function,beginner

Checks if the given argument is a function.

Use typeof to check if a value is classified as a function primitive.

const isFunction = val => typeof val === 'function';
isFunction('x'); // false
isFunction(x => x); // true