Tot*_*oro 4 javascript syntax-error
我正在做一个Web应用程序,当我开始用JavaScript编写代码时,我收到了这个错误:
Syntax error: unexpected token "-" javascript
Run Code Online (Sandbox Code Playgroud)
我正在使用Aptana Studio 3.我认为这是Aptana的问题,所以我尝试使用Eclipse,但仍然遇到了同样的错误.Eclipse向我显示了这个错误:
Cannot return from outside a function or method.
Run Code Online (Sandbox Code Playgroud)
这是我的功能:
function www_ebest_eu_company_node_service_task-slot-info () {
this.typeMarker = 'www_ebest_eu_company_node_service_task-slot-info';
this._endDateTime = null;
this._number = null;
this._orderId = null;
this._startDateTime = null;
this._taskId = null;
this._taskStatus = null;
}
Run Code Online (Sandbox Code Playgroud)
我有很多这样的功能,对于每一个我都得到同样的错误.
有没有人有同样的问题?
您不能在JavaScript函数名称中使用连字符:
function www_ebest_eu_company_node_service_task-slot-info () {
// Should proabbly be
function www_ebest_eu_company_node_service_task_slot_info () {
//---------------------------------------------^^^^^^^^
Run Code Online (Sandbox Code Playgroud)