Javascript Developer JSE 40 01 · Free Practice Question Easy
Question 12
Q503 - Basics
A client-side JavaScript program:
-
A
requires server support to run.
-
B
should be embedded inside an HTML document.
-
C
may be embedded inside an HTML document
or run standalone in the browser.
-
D
runs directly in a web browser and can contain
an HTML document inside it.
Reveal correct answer
Correct answer: B
Explanation
Topics: client-side scripting JavaScript HTML
Try it yourself:
- <!DOCTYPE html>
- <html>
- <head>
- <title>Q503</title>
- <meta charset="UTF-8">
- </head>
- <body>
- <script>
- console.log("I am a client-side JavaScript program"
- + "and I am embedded inside this HTML document.");
- </script>
- </body>
- </html>
Explanation:
Client-side scripting is changing interface behaviours
within a specific web page in response to input device actions,
or at specified timing events.
https://en.wikipedia.org/wiki/Dynamic_web_page#Client-side_scripting
JavaScript (JS) is a lightweight, interpreted programming language.
https://developer.mozilla.org/en-US/docs/Web/JavaScript
The HyperText Markup Language, or HTML is the standard markup language
for documents designed to be displayed in a web browser.
https://en.wikipedia.org/wiki/HTML
(There is a similar question Q303.)
Q503 (Please refer to this number, if you want to write me about this question.)
A. This choice is incorrect because client-side JavaScript does not require server support to run. It is executed on the client's browser without the need for server interaction.
B. This choice is correct because client-side JavaScript programs are typically embedded inside an HTML document to interact with the elements on the web page and manipulate the DOM.
C. This choice is correct because client-side JavaScript can be embedded inside an HTML document using script tags or run standalone in the browser. It offers flexibility in how the JavaScript code is included and executed.
D. This choice is incorrect because while client-side JavaScript runs directly in a web browser, it does not contain an HTML document inside it. Instead, it interacts with the HTML document that is loaded in the browser.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
