Javascript错误的可能情况:“预期标识符,字符串或数字” [英] Possible cases for Javascript error: "Expected identifier, string or number"

查看:169
本文介绍了Javascript错误的可能情况:“预期标识符,字符串或数字”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有些用户在我的网站上偶尔会报告JS错误。错误消息显示预期标识符,字符串或数字,行号为423725915,这只是一个任意数字,并在发生这种情况时为每个报告更改。
这主要发生在IE7 / Mozilla 4.0浏览器上。

Some users are reporting occasional JS errors on my site. The error message says "Expected identifier, string or number" and the line number is 423725915, which is just an arbitrary number and changes for each report when this occurs. This mostly happens with IE7/ Mozilla 4.0 browsers.

我扫描了我的代码很多次并运行了jslint但它没有选择任何东西 - 任何人知道导致此错误消息的JS问题的一般类型吗?

I scanned my code a bunch of times and ran jslint but it didn't pick anything up - anyone know of the general type of JS problems that lead to this error message?

推荐答案

此类错误的原因通常是对象或数组定义中错误放置的逗号:

The cause of this type of error can often be a misplaced comma in an object or array definition:

var obj = {
   id: 23,
   name: "test",  <--
}

如果它随机出现也许它是动态创建的对象定义的一部分。

If it appears at a random line, maybe it's part of an object defintion you are creating dynamically.

这篇关于Javascript错误的可能情况:“预期标识符,字符串或数字”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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