Hi, I'm Jacob. Enjoying devFlipCards? Buy me a coffee

14. How to convert any value to boolean

The easiest way is to use double negation syntax or Boolean constructor

const str = "string"; const one = 1; const zero = 0; console.info(!!str, !!one, !!zero); //true, true, false console.info(Boolean(str), Boolean(one), Boolean(zero)); //true, true, false
Struggling to find common date to meet with your friends? Try our new tool
commondate.xyz