let's see a simple trick how we can convert any type of variable to boolean in javaScript using !! operator.

On many occasions we need to check whether some variable exists or if it has a valid value, to consider them as true value . For do this kind of validation, you can use the !!  ( Double negation operator) a simple !!anyVariable, which will automatically convert any kind of data to boolean and this variable will return false only if it has some of these values: 0, null, "", undefined or NaN, otherwise it will return true. yt

Now let's Log

$ node main.js

Output in Terminal

129.22
true
0
false

In this case, if an mobileOne.Balance value is greater than zero, the mobileOne.hasBalance will be true.

I hope this may help you.