TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

JavaScript Semicolons Are Not Necessary

3 点作者 Lennu将近 9 年前

3 条评论

partycoder将近 9 年前
From Google, authors of V8 and Chrome, if their opinion means anything to you: <a href="https:&#x2F;&#x2F;google.github.io&#x2F;styleguide&#x2F;javascriptguide.xml?showone=Semicolons#Semicolons" rel="nofollow">https:&#x2F;&#x2F;google.github.io&#x2F;styleguide&#x2F;javascriptguide.xml?show...</a>
alexc05将近 9 年前
I remember having a bug once in (I think) IE8 where I had a comma after the last element an an array (like the &#x27;greatarray&#x27; shown in this article.<p>The browser didn&#x27;t accept a comma after the last element in an array and IIRC the compiler breaks so badly that it puts the reported error at line 1 character 1, possibly for a different file entirely.<p>Spent a LONG time on that.<p>I kind of reject his assertion that JavaScript without semi colons is &quot;better code&quot;<p>The logic, flow, maintainability, understandability, performance and, actually doing the right thing all make for better code.<p>Semicolons? Not so much.
mcbits将近 9 年前
Semicolon presence or absence is usually the least annoying factor to me in how other people write their JavaScript code.