Hello Friends 👋,
Welcome To Infinitbility! ❤️
Today, we will know easiest way to convert number to boolean in typescript.
!! double exclamation which help you to convert number to boolean like when we add double exclamation with
1 it will return
0 it will return
Take an example
1let statusZero: number = 0;2let statusOne: number = 1;34console.log(!!statusZero) // false5console.log(!!statusOne) // true
!! double exclamationreturn false for
0only else it return
truefor any number.
Thanks for reading…
Follow me on Twitter
Join our email list and get notified about new content
No worries, I respect your privacy and I will never abuse your email.
Every week, on Tuesday, you will receive a list of free tutorials I made during the week (I write one every day) and news on other training products I create.