在下列代码中,那段代码可以求算出numbers数组的最大值?
A. var numbers = [1, 1, 2, 3, 5, 8];var max = Math.max(numbers);
B. var numbers = [1, 1, 2, 3, 5, 8];var max = Math.max(...numbers);
C. var numbers = [1, 1, 2, 3, 5, 8];var max = Math.max(numbers...);
D. var numbers = [1, 1, 2, 3, 5, 8];var max = Math.max(*numbers);
查看答案
以下代码的运行结果是什么?function f(...args) {var result = 0;args.forEach(function (value) {result += value;});return result;}f(1, 2, 5);
A. 1
B. 5
C. 8
D. 10
以下代码的输出结果是:function sayHello(greeting = "Hello", name = "CampJS") {console.log(`${greeting} ${name}!`);}sayHello("Hi there");sayHello(undefined, null);
A. Hello CampJS!Hello CampJS!
B. Hi thereCampJS!undefined CampJS!
C. Hi thereCampJS!Hello null!
D. Hi thereCampJS!undefined null!
以下代码的输出结果是:function log(arg, transform = x => x) {console.log(transform(arg));}log("Hello");log("Hello", y => y.toUpperCase());
A. HelloHELLO
B. helloHELLO
C. hellohello
D. HELLOHELLO
在JavaScript当中,关于==与===的描述正确的是?
A. 前者在比较前会先转换类型
B. 后者在比较前会先转换类型
C. 前者要求类型完全一致
D. 后者要求类型完全一致