Created
March 1, 2019 16:03
-
-
Save YaroslavW/1a247cdb669aaf17c46493a28d767d02 to your computer and use it in GitHub Desktop.
null and undefined checking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ===> For Null | |
const isNull = (val) => !val && typeof val === 'object'; | |
isNull(null); // true | |
// ===> For undifined | |
const isUndefined = (value) => typeof value === 'undefined'; | |
isUndefined(undefined); // true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment