最新的Salesforce Certified JavaScript Developer (JS-Dev-101) - JavaScript-Developer-I免費考試真題
問題1
Given the following code:
let x = ( ' 15 ' + 10) * 2;
What is the value of x?
let x = ( ' 15 ' + 10) * 2;
What is the value of x?
正確答案: B
說明:(僅 VCESoft 成員可見)
問題2
static delay = async delay = > {
return new Promise(resolve = > {
setTimeout(resolve, delay);
});
};
static asyncCall = async () = > {
await delay(1000);
console.log(1);
};
console.log(2);
asyncCall();
console.log(3);
Assume delay and asyncCall are in scope as functions.
What is logged to the console?
return new Promise(resolve = > {
setTimeout(resolve, delay);
});
};
static asyncCall = async () = > {
await delay(1000);
console.log(1);
};
console.log(2);
asyncCall();
console.log(3);
Assume delay and asyncCall are in scope as functions.
What is logged to the console?
正確答案: D
說明:(僅 VCESoft 成員可見)
問題3
Most accurate tests for:
const arr = Array(5).fill(0);
const arr = Array(5).fill(0);
正確答案: A,C
說明:(僅 VCESoft 成員可見)
問題4
Refer to the code below:
01 function changeValue(param) {
02 param = 5;
03 }
04 let a = 10;
05 let b = a;
06
07 changeValue(b);
08 const result = a + ' - ' + b;
What is the value of result when the code executes?
01 function changeValue(param) {
02 param = 5;
03 }
04 let a = 10;
05 let b = a;
06
07 changeValue(b);
08 const result = a + ' - ' + b;
What is the value of result when the code executes?
正確答案: A
說明:(僅 VCESoft 成員可見)
問題5
Given the following code:
01 counter = 0;
02 const logCounter = () = > {
03 console.log(counter);
04 };
05 logCounter();
06 setTimeout(logCounter, 2100);
07 setInterval(() = > {
08 counter++;
09 logCounter();
10 }, 1000);
What will be the first four numbers logged?
01 counter = 0;
02 const logCounter = () = > {
03 console.log(counter);
04 };
05 logCounter();
06 setTimeout(logCounter, 2100);
07 setInterval(() = > {
08 counter++;
09 logCounter();
10 }, 1000);
What will be the first four numbers logged?
正確答案: C
說明:(僅 VCESoft 成員可見)
問題6
Refer to the code below:
let strNumber = ' 12345 ' ;
Which code snippet shows a correct way to convert this string to an integer?
let strNumber = ' 12345 ' ;
Which code snippet shows a correct way to convert this string to an integer?
正確答案: B
說明:(僅 VCESoft 成員可見)
問題7
Refer to the code below:
01 const myFunction = arr = > {
02 return arr.reduce((result, current) = > {
03 return result + current;
04 }, 10);
05 }
What is the output of this function when called with an empty array?
01 const myFunction = arr = > {
02 return arr.reduce((result, current) = > {
03 return result + current;
04 }, 10);
05 }
What is the output of this function when called with an empty array?
正確答案: C
說明:(僅 VCESoft 成員可見)
問題8
A developer is setting up a new Node.js server with a client library that is built using events and callbacks.
The library:
* Will establish a web socket connection and handle receipt of messages to the server.
* Will be imported with require, and made available with a variable called ws.
* The developer also wants to add error logging if a connection fails.
Given this information, which code segment shows the correct way to set up a client with two events that listen at execution time?
The library:
* Will establish a web socket connection and handle receipt of messages to the server.
* Will be imported with require, and made available with a variable called ws.
* The developer also wants to add error logging if a connection fails.
Given this information, which code segment shows the correct way to set up a client with two events that listen at execution time?
正確答案: D
說明:(僅 VCESoft 成員可見)
問題9
Refer to the code below:
01 < html lang= " en " >
02 < table onclick= " console.log( ' Table log ' ); " >
03 < tr id= " row1 " >
04 < td > Click me! < /td >
05 < /tr >
06 < /table >
07 < script >
08 function printMessage(event) {
09 console.log( ' Row log ' );
10 event.stopPropagation();
11 }
12
13 let elem = document.getElementById( ' row1 ' );
14 elem.addEventListener( ' click ' , printMessage, false);
15 < /script >
16 < /html >
Which code change should be done for the console to log the following when " Click me! " is clicked?
Row log
Table log
01 < html lang= " en " >
02 < table onclick= " console.log( ' Table log ' ); " >
03 < tr id= " row1 " >
04 < td > Click me! < /td >
05 < /tr >
06 < /table >
07 < script >
08 function printMessage(event) {
09 console.log( ' Row log ' );
10 event.stopPropagation();
11 }
12
13 let elem = document.getElementById( ' row1 ' );
14 elem.addEventListener( ' click ' , printMessage, false);
15 < /script >
16 < /html >
Which code change should be done for the console to log the following when " Click me! " is clicked?
Row log
Table log
正確答案: C
說明:(僅 VCESoft 成員可見)
問題10
Which three actions can the code execute in the browser console?
正確答案: B,C,E
說明:(僅 VCESoft 成員可見)

