JS parseBool()

This function cast any variable into type ‘boolean’

function parseBool(value) {
     return !!value;
}

console.log(typeof parseBool({}));
// “boolean"
Share this...
Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInPin on Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *