因为void返回的值是undefined,直接用两个括号去包裹函数执行需要用符号;在第一个括号之前,否则函数会被当成参数执行,所以用void的方式去写立即执行参数更好。 void function () { console.log(a); console.log(b); }() Last modification:September 6, 2019 © Allow specification reprint Support Appreciate the author AliPayWeChat Like If you think my article is useful to you, please feel free to appreciate
One comment