diff --git a/README.md b/README.md index c8c3c420d..a3a15cd6b 100644 --- a/README.md +++ b/README.md @@ -4904,13 +4904,14 @@ 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 => val && typeof val === 'function'; +const isFunction = val => typeof val === 'function'; ```
Examples ```js +isFunction(null); // false isFunction('x'); // false isFunction(x => x); // true ``` diff --git a/docs/index.html b/docs/index.html index 4709be488..2e38edaa9 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1088,8 +1088,9 @@ a === b;

isBoolean

Checks if the given argument is a native boolean element.

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

const isBoolean = val => typeof val === 'boolean';
 
isBoolean(null); // false
 isBoolean(false); // true
-

isFunction

Checks if the given argument is a function.

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

const isFunction = val => val && typeof val === 'function';
-
isFunction('x'); // false
+

isFunction

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(null); // false
+isFunction('x'); // false
 isFunction(x => x); // true
 

isNull

Returns true if the specified value is null, false otherwise.

Use the strict equality operator to check if the value and of val are equal to null.

const isNull = val => val === null;
 
isNull(null); // true