Exam JavaScript-Developer-I Topic 4 Question 108 Discussion

Actual exam question for Salesforce's JavaScript-Developer-I exam
Question #: 108
Topic #: 4
A page loads 50+ < div class= " ad-library-item " > elements, all ads.
Developer wants to quickly and temporarily remove them.
Options:

Suggested Answer: C Vote an answer

The goal:
" Temporarily and quickly remove them. "
The fastest way is to run a script in the browser console that removes all such elements:
document.querySelectorAll( ' .ad-library-item ' ).forEach(el = > el.remove()); This immediately removes all 50+ elements and requires no page reload.
Option analysis:
* A & B : Preventing load events is unreliable and does not remove already-created DOM nodes.
* C : Correct-console code can remove all matching DOM elements instantly.
* D : Possible but extremely slow; removing 50+ elements one by one in the inspector is not "quick." Therefore, C is the best answer.
JavaScript Knowledge References (text-only)
* The browser console can run arbitrary JavaScript that manipulates the DOM.
* document.querySelectorAll() returns all matching DOM nodes.
* Nodes can be removed using .remove().

by Frank at Jul 04, 2026, 02:23 AM

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Nick name: Submit Cancel
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

0
0
0
10