Files
30-seconds-of-code/snippets/isFunction.md
2022-12-04 22:20:49 +02:00

415 B

title, tags, cover, firstSeen, lastUpdated
title tags cover firstSeen lastUpdated
Value is function type,function blog_images/boulder-beach.jpg 2017-12-17T17:55:51+02:00 2020-09-15T16:28:04+03:00

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