&& operator in Javascript

后端 未结 4 762
清歌不尽
清歌不尽 2020-11-29 06:27

While looking through some code (javascript), I found this piece of code:



        
4条回答
  •  清酒与你
    2020-11-29 06:31

    && makes sure that the Bootloader function/object exists before calling the done method on it. The code takes advantage of boolean short circuiting to ensure the first expression evaluates to true before executing the second. See the short-circuit evaluation wikipedia entry for a more in-depth explanation.

提交回复
热议问题