JavaScript入学考试提高(附答案).docVIP

  • 2
  • 0
  • 约3.31千字
  • 约 10页
  • 2026-10-11 发布于四川
  • 举报

JavaScript入学考试提高(附答案)

一、单项选择题(每题2分,共20分)

1.以下哪种方式可以正确声明一个变量并赋值为字符串hello?

A.varhello=123;

B.varhello=hello;

C.var123=hello;

D.varhello=[hello];

2.JavaScript中,函数内部使用`this`关键字,在全局作用域中调用函数时,`this`指向什么?

A.函数本身

B.全局对象(在浏览器中是`window`对象)

C.`null`

D.未定义

3.以下哪个是JavaScript中数组的正确创建方式?

A.vararr=(1,2,3);

B.vararr=[1,2,3];

C.vararr={1,2,3};

D.vararr=1,2,3;

4.以下关于JavaScript中`if`语句的语法,正确的是?

A.if(condition){statement}

B.ifcondition{statement}

C.if[condition]{statement}

D.if{condition}(statement)

5.要获取一个字符串的长度,应该使用以下哪个方法?

A.lengt

文档评论(0)

1亿VIP精品文档

相关文档