JS-Dev-101 practice question 15 of 25

Which actions can be done using the JavaScript browser console?

Full set: 148 questions
Answer options
A: Run code that’s not related to the page Correct answer
B: View and change the DOM of the page Correct answer
C: Display a report showing the performance of a page
D: Change the DOM and the JavaScript code of the page Correct answer
E: View and change security cookies
Correct Answer:
A. Run code that’s not related to the page; B. View and change the DOM of the page; D. Change the DOM and the JavaScript code of the page
Explanation

The Console panel is an interactive JavaScript REPL.
• It can execute any arbitrary JavaScript, even code unrelated to the current page (A).
• Because it shares the same execution context as the page, you can inspect and mutate DOM nodes directly (B) and redefine variables/functions, thereby changing both DOM-backed objects and the page’s running JavaScript (D). The Performance panel, not the console, produces page-performance reports (C). Cookies marked HttpOnly are inaccessible from JavaScript, so they cannot be viewed/changed through the console (E).

Why Incorrect

C. Console lacks built-in UI for full performance reports; such reports live in DevTools’ Performance/Lighthouse panels.
E. HttpOnly/Secure flags block access via document.cookie, so the console cannot guarantee viewing or editing security cookies.

References

1. Google Chrome DevTools “Console as a REPL”, DevTools Docs v121, §Run JavaScript in Console.

2. Google Chrome DevTools “Manipulate the DOM with Console”, DevTools Docs v121, §Interact with the page DOM.

3. RFC6265 §4.1.2.6 (HttpOnly) – cookies inaccessible to client-side scripts.

Scroll to Top