How js uses comma operators
This article mainly introduces how js uses the comma operator, which has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to understand it.
Comma operator
I'm not talking about using comma delimiters to separate objects or elements in containers, such as const arr = [2, 7, 4, 8, 8].
In the expression const a = (2p3), the comma operator allows the entire expression in parentheses to be evaluated, so let's look at some interesting examples:
Basically, this operator executes and & & and | | between the left and right operands at the same time, because it executes the state of both operands.
If you are still confused about its use, think of it this way: it allows you to evaluate multiple expressions where JavaScript expects one expression. This may be to present more elegant code, or to make it easier to debug.
Thank you for reading this article carefully. I hope the article "how to use the comma operator in js" shared by the editor will be helpful to you. At the same time, I also hope you will support us and follow the industry information channel. More related knowledge is waiting for you to learn!