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 JS-Dev-101 Exam - Topic 1 Question 12 Discussion

Posted by Louvenia on Jul 20, 2026 at 10:57 PM

Refer to the code below:

01

02

03

04

05

06

Click me!

07

16

Which code change should be done for the console to log the following when "Click me!" is clicked?

Row log

Table log

Suggested Answer: D

Current behavior:

Clicking <td> triggers the click event on row1, then bubbles up to <table>.

printMessage runs, logs 'Row log', then event.stopPropagation() stops the event from bubbling to the table.

So 'Table log' never appears.

To allow the table's inline onclick to run after the row handler:

Remove the propagation stop:

function printMessage(event) {

console.log('Row log');

// event.stopPropagation(); // remove this

}

Now the event bubbles:

printMessage logs 'Row log'.

The table's onclick runs, logging 'Table log'.

Option A only changes capture/bubble phase but still stops propagation. C does nothing meaningful (stopPropagation takes no arguments). B removes the row handler entirely.


Get Premium JS-Dev-101 Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
12 comments · newest first
TW
Twana 1 month ago
I’m leaning towards option B. Removing those lines simplifies it.
GI
Giovanna 1 month ago
I feel like option D makes sense. Removing line 10 allows both logs.
GL
Glory 1 month ago
I think option A is correct. It changes the event to capture phase.
SH
Shaquana 2 months ago
Not sure about that, can we really trust event.stopPropagation(false)?
SH
Sharee 2 months ago
Totally agree with A), it’s the only way to log both messages.
PA
Paul 2 months ago
Wait, changing to true? That sounds risky!
RU
Ruby 2 months ago
I think D) makes more sense, just let it bubble up.
LE
Leonardo 2 months ago
A) is the right choice for capturing the event in the capturing phase.
CH
Christiane 2 months ago
I’m confused about option C. Changing stopPropagation to false doesn’t seem right, but I can't remember what the default behavior is.
VI
Vi 3 months ago
I feel like option B is a bit drastic. Removing those lines seems like it would break the functionality completely.
LO
Loren 3 months ago
I remember a practice question where stopping propagation was crucial. If we remove line 10, like in option D, wouldn't that let both logs happen?
RO
Rolland 3 months ago
I think we need to allow the event to bubble up to the table, so maybe option A is right? But I'm not entirely sure about the use of true or false in event listeners.
0/2000 characters

Save Cancel