問題:
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