Valid JS-Dev-101 Dumps shared by EduDump.com for Helping Passing JS-Dev-101 Exam! EduDump.com now offer the newest JS-Dev-101 exam dumps, the EduDump.com JS-Dev-101 exam questions have been updated and answers have been corrected get the newest EduDump.com JS-Dev-101 dumps with Test Engine here:
Refer to the code below: 01 <html lang="en"> 02 <table onclick="console.log('Table log');"> 03 <tr id="row1"> 04 <td>Click me!</td> 05 </tr> 06 </table> 07 <script> 08 function printMessage(event) { 09 console.log('Row log'); 10 event.stopPropagation(); 11 } 12 13 let elem = document.getElementById('row1'); 14 elem.addEventListener('click', printMessage, false); 15 </script> 16 </html> Which code change should be done for the console to log the following when "Click me!" is clicked? Row log Table log
Correct 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.