diff --git a/snippets/isPrimitive.md b/snippets/isPrimitive.md index 900d83d77..ebe691262 100644 --- a/snippets/isPrimitive.md +++ b/snippets/isPrimitive.md @@ -7,7 +7,7 @@ supplying the type using `typeof`. Since `typeof null` evaluates to `'object'`, it needs to be directly compared. ```js -const isPrimitive = val => !['object', 'function'].includes(typeof val) || val === null; +const isPrimitive = val => Object(val) !== val; ``` ```js