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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Dealing with JavaScript's Automatic Semicolon Insertion

3 点作者 niyazpk超过 12 年前

1 comment

elclanrs超过 12 年前
-"But to save yourself time and troubles, just place them all the time"- Or to save even more time, just put semicolons before raw expressions (not very common at all) and omit them everywhere else. ASI is a feature not a problem like many people make it look like. A good informative article nonetheless.<p><pre><code> ;(function(){}()) // Common IIFE 'use strict'; // need semicolon here // Not very common without an assignment ;'string'.method() ;[0,1,2,3].method() ;/regex/.method()</code></pre>