Home

Published

- 1 min read

javascript falsy check

img of javascript falsy check

The solution for this is noted below

javascript falsy check

Solution

   //Check if a value is falsy

// Short version
const isFalsy = (value) => !value

// Long version
const isFalsy = (value) => {
	if (
		value === null ||
		value === undefined ||
		value === 0 ||
		value === false ||
		value === NaN ||
		value === ''
	) {
		return true
	}
	return false
}

Try other methods by searching on the site. That is if this doesn’t work