ExamGecko
Home Home / Salesforce / Certified JavaScript Developer I

Salesforce Certified JavaScript Developer I Practice Test - Questions Answers, Page 21

Question list
Search
Search

List of questions

Search

Related questions











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?

A.
setInterval(isDog, 60000,'cat');
A.
setInterval(isDog, 60000,'cat');
Answers
Suggested answer: A

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?

A.
Puppy is barking
A.
Puppy is barking
Answers
Suggested answer: A

Given the HTML below:

Which statement adds the priority-account css class to the Applied Shipping row?

A.
document.querySelector('#row-as').classList.add('priority-account');
A.
document.querySelector('#row-as').classList.add('priority-account');
Answers
Suggested answer: A

Refer to the following code:

A.
A.
Answers
Suggested answer:

Refer to the HTML below:

Which JavaScript statement results in changing " The Lion."?

A.
document.querySelectorAll('$main ONY').innerHTML = '" The Lion
A.
document.querySelectorAll('$main ONY').innerHTML = '" The Lion
Answers
B.
document.querySelector('$main li:second-child').innerHTML = " The Lion ';
B.
document.querySelector('$main li:second-child').innerHTML = " The Lion ';
Answers
C.
document.querySelector('$main li.Tony').innerHTML = '" The Lion ';
C.
document.querySelector('$main li.Tony').innerHTML = '" The Lion ';
Answers
D.
document.querySelector('$main li:nth-child(2)'),innerHTML = " The Lion. ';
D.
document.querySelector('$main li:nth-child(2)'),innerHTML = " The Lion. ';
Answers
Suggested answer: A

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?

A.
event.target.id =='myElement'
A.
event.target.id =='myElement'
Answers
Suggested answer: A

Given the following code:

let x = null;

console.log(typeof x);

What is the output?

A.
"object"
A.
"object"
Answers
B.
"undefined"
B.
"undefined"
Answers
C.
"null"
C.
"null"
Answers
D.
"x"
D.
"x"
Answers
Suggested answer: A

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?

A.
Car2 completed the race.
A.
Car2 completed the race.
Answers
Suggested answer: A

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?

A.
4 2 1 5 3
A.
4 2 1 5 3
Answers
Suggested answer: A

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.

A.
0
A.
0
Answers
B.
6
B.
6
Answers
C.
Error
C.
Error
Answers
D.
-Infinity
D.
-Infinity
Answers
Suggested answer: C
Total 224 questions
Go to page: of 23