Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce Exam Javascript Developer I Topic 2 Question 90 Discussion

Actual exam question for Salesforce's Javascript Developer I exam
Question #: 90
Topic #: 2
[All Javascript Developer I Questions]

Given the following code:

document.body.addEventListener(' click ', (event) => {

if (/* CODE REPLACEMENT HERE */) {

console.log('button clicked!');

)

});

Which replacement for the conditional statement on line 02 allows a developer to

correctly determine that a button on page is clicked?

Show Suggested Answer Hide Answer
Suggested Answer: C

Contribute your Thoughts:

Alaine
11 days ago
Hmm, I think option C is the correct answer. The code is checking if the clicked element is a button, which seems like the right way to detect a button click.
upvoted 0 times
...
Reed
13 days ago
I'm not sure, but I think D) button.addEventListener('click') could also work to detect button clicks.
upvoted 0 times
...
Glen
14 days ago
I agree with Winfred. Option C makes sense because it specifically targets buttons.
upvoted 0 times
...
Winfred
15 days ago
I think the correct answer is C) event.target.nodeName == 'BUTTON'. It checks if the target element is a button.
upvoted 0 times
...

Save Cancel