A developer needs to test this function:
01const sum3 = (arr) => (
02if (!arr.length) return 0,
03if (arr.length === 1) return arr[0],
04if (arr.length === 2) return arr[0]+ arr[1],
05 return arr[0] + arr[1] + arr[2],
06 );
Which two assert statements are valid tests for the function? Choose 2 answers
Correct Answer:
AC
Refer to the HTML below:
Correct Answer:
D
Refer to the code below:
Which code executes sayHello once, two minutes from now?
Correct Answer:
A
Which statement accurately describes the behaviour of the async/ await keyworks ?
Correct Answer:
B
Refer to the code below:
Let car1 = new Promise((_ , reject) => setTimeout(reject, 2000, “car 1 crashed in” =>
Let car2 =new Promise(resolve => setTimeout(resolve, 1500, “car 2 completed”) Let car3 =new Promise(resolve => setTimeout(resolve, 3000, “car 3 completed”) Promise.race(( car1, car2, car3))
.t hen (value => (
Let result = ‘$(value) the race.’;)}
.catch(arr => {
console.log(“Race is cancelled.”, err);
});
What isthe value of result when Promise.race executes?
Correct Answer:
B