本文介绍了为什么浏览器不会因语法错误而抛出异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不小心写了一个错误的JavaScript语法(我想是这样)。

I accidentally wrote a wrong JavaScript syntax (I think so).

代码是

  var temp = {};
    temp.a = 34;
    height:34, //should fail here.
    temp.b = 56;

,这就是这里发生的事情。您的代码中没有错误,这是预期的行为。

A colon can be used to label a statement, and that's what's happening here. There are no errors in your code, it's intended behavior.

编辑:。 :)

这篇关于为什么浏览器不会因语法错误而抛出异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 11:04
查看更多