我们最后需要分号吗? [英] Do we need semicolon at the end?

查看:104
本文介绍了我们最后需要分号吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在JavaScript中的某些地方错过了分号,但它并没有在任何浏览器中抛出错误。是否需要;

I missed semicolons in some of the places in my JavaScript, but its not throwing error in any of the browsers. Is the ; at the end needed?

推荐答案

这个概念已知as JavaScript分号插入自动分号插入。此博文: JavaScript分号插入:您需要知道的一切 使用标题下的示例以可理解的方式概述概念:

The concept is known as JavaScript Semicolon Insertion or "Automatic Semicolon Insertion". This blog post: JavaScript Semicolon Insertion: Everything you need to know outlines the concept well in an understandable manner using examples under the headings:


  • 允许使用分号

  • 可以省略分号的地方

  • 规则

它甚至可以深入研究关于该主题的官方ECMAScript规范

It even digs into the official ECMAScript specification about the topic.

这篇关于我们最后需要分号吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆