当前位置: 代码迷 >> JavaScript >> 为什么这样会出错?import是jscript的保留字?该怎么处理
  详细解决方案

为什么这样会出错?import是jscript的保留字?该怎么处理

热度:143   发布时间:2012-02-22 19:36:55.0
为什么这样会出错?import是jscript的保留字?
System.import   =   function(abc)   {
alert(abc);
}
这样就老是出错。

System.import1   =   function(abc)   {
alert(abc);
}
就正常了。

------解决方案--------------------
完全没错,import 就是保留字!

Table C-1: Reserved Words in JavaScript 1.5 > abstract
else
instanceof
switch

boolean
enum
int
synchronized

break
export
interface
this

byte
extends
long
throw

case
false
native
throws

catch
final
new
transient

char
finally
null
true

class
float
package
try

const
for
private
typeof

continue
function
protected
val

debugger
goto
public
var

default
if
return
void

delete
implements
short
volatile

do
import
static
while

double
in
super
with

Table C-2: Potentially Reserved Words As
event
Is
uint

Assert
get
Namespace
ulong

Decimal
include
Require
use

Ensure
internal
Sbyte
ushort

Exclude
invariant
Set


------解决方案--------------------
MARK
------解决方案--------------------
重贴一下,哈

============================================
Table C-1: Reserved Words in JavaScript 1.5
============================================
abstract else instanceof switch
boolean enum int synchronized
break export interface this
byte extends long throw
case false native throws
catch final new transient
char finally null true
class float package try
const for private typeof
continue function protected val
debugger goto public var
default if return void
delete implements short volatile
do import static while
double in super with

============================================
Table C-2: Potentially Reserved Words
============================================
As event Is uint
Assert get Namespace ulong
Decimal include Require use
Ensure internal Sbyte ushort
Exclude invariant Set

------解决方案--------------------
有答对了,保留字滴含义就是“占茅坑”字,哈

既然知道了就快 SF 吧
------解决方案--------------------
学习,SF~
  相关解决方案