问题:
I once heard that leaving the curly braces in one-line statements could be harmful in JavaScript.我曾经听说在单行语句中保留大括号在 JavaScript 中可能是有害的。 I don't remember the reasoning anymore and a Google search did not help much.我不记得推理了,谷歌搜索也没有多大帮助。
Is there anything that makes it a good idea to surround all statements within curly braces in JavaScript?在 JavaScript 中,将所有语句括在花括号内是否是一个好主意?
I am asking, because everyone seems to do so.我问,因为每个人似乎都这样做。
解决方案:
参考一: https://en.stackoom.com/question/K7za参考二: https://stackoom.com/question/K7za