Skip to content

Home > @zero-dim/utils > isFunction

isFunction() function

判断值是否为函数类型

Signature:

typescript
export declare function isFunction(val: unknown): boolean;

Parameters

Parameter

Type

Description

val

unknown

要检查的值

**Returns:**

boolean

如果值为函数类型则返回true,否则返回false

Example

ts
isFunction(function(){})     // true
isFunction(() => {})         // true
isFunction(class{})          // true
isFunction(123)              // false