Salesforce Certified JavaScript Developer I Practice Test - Questions Answers, Page 21
List of questions
Question 201
A developer has an is Dog function that takes one argument cat. They want to schedule the function to run every minute.
What is the correct syntax for scheduling this function?
Question 202
Refer to the following code block:
class Animal{
constructor(name){
this.name = name;
}
makeSound(){
console.log(`${this.name} is making a sound.`)
}}
class Dog extends Animal{
constructor(name){
super(name)
this.name = name;
}
makeSound(){
console.log(`${this.name} is barking.`)
}}l
et myDog = new Dog('Puppy');
myDog.makeSound();
What is the console output?
Question 203
Given the HTML below:
Which statement adds the priority-account css class to the Applied Shipping row?
Question 204
Refer to the following code:
Question 205
Refer to the HTML below:
Which JavaScript statement results in changing " The Lion."?
Question 206
Refer to the code below:
Which replacement for the conditional statement on line 02 allows a developer to correctly determine that a specific element, myElement on the page had been clicked?
Question 207
Given the following code:
let x = null;
console.log(typeof x);
What is the output?
Question 208
Refer to the code below:
let car1 = new Promise((_ ,reject)=> setTimeout(reject,2000,"Car1 crashed in"));
let car2 = new Promise(resolve => setTimeout(resolve,1500,"Car2 completed"));
let car3 = new Promise(resolve => setTimeout(resolve,3000,"Car3 completed"));
Promise.race([car1,car2,car3])
.then(value=>{
let result = `${value} the race.`;
}).catch(err=>{
console.log('Race is cancelled.',err);
});
What is the value of result when promise.race execues?
Question 209
Given the code below:
const delay = async delay =>{
return new Promise((resolve,reject)=>{
console.log(1);
setTimeout(resolve,deleay);
});
};
const callDelay = async ()=>{
console.log(2);
const yup = await delay(1000);
console.log(3);
}
console.log(4);
callDelay();
console.log(5);
What is logged to the console?
Question 210
A developer writes the code below to calculate the factorial of a given number
function sum(number){
return number * sum(number-1);
}
sum(3);
what is the result of executing the code.
Question