var a = true;
How to get opposite value of a (false) and vice versa?
>>> a = true;
true
>>> !a;
false
a = false as well. I wasn't sure at first.Use the logical NOT operator:
!a
Something like this, perhaps;
function toggleFlag(value){
var toggle = value ? false : true;
return toggle;
}
var a = true;
a = toggleFlag(a);
Try like Below
var Boolify = require('node-boolify').Boolify;
var opp_var = !Boolify(myVar);
Refer node-boolify