How to toggle a boolean in Node.js

2 Answers

0 votes
let bool = true;
 
bool = !bool;
console.log(bool);
 
bool = !bool;
console.log(bool);
 
bool = !bool;
console.log(bool);
 
bool = !bool;
console.log(bool);
   
   
   
   
/*
run:
 
false
true
false
true
   
*/

 



answered May 9, 2022 by avibootz
0 votes
console.log(!true); 
console.log(!false); 
 
   
   
   
   
/*
run:
 
false
true
   
*/

 



answered May 9, 2022 by avibootz

Related questions

2 answers 152 views
1 answer 170 views
2 answers 194 views
2 answers 171 views
171 views asked May 9, 2022 by avibootz
2 answers 165 views
2 answers 149 views
...