How to use the & & operator to simplify the expression of JavaScript
This article is about how JavaScript uses the & & operator to simplify expressions. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Use the & & operator to simplify the expression
Let's consider a case with Boolean values and functions.
Let isPrime = true;const startWatching = () = > {console.log ('Started watches');}
Like below, there is too much code to determine whether to call a function by checking a Boolean value.
If (isPrime) {startWatching ();}
Can I use the abbreviated form through the AND (& &) operator? Yes, you can completely avoid using if statements. Cool!
IsPrime & & startWatching (); Thank you for your reading! This is the end of the article on "how to use JavaScript & operator simplified expression". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!