what does !! before variable mean javascript code example
Example: ! before variable javascript
// ! before a boolean variable will reverse the value:
var test = true;
console.log(test); // True
console.log(!test); // False
// In JavaScript, every value has an inherent boolean value.
// If you use ! on a string, for instance, it will convert the value
// to a bool. This is useful to see if the string exists:
var stringTest1 = "hello!";
var stringTest2 = "";
console.log(stringTest1); // hello!
console.log(!stringTest1); // False
console.log(stringTest2); //
console.log(!stringTest2); // True