Javascript Developer JSE 40 01 · Free Practice Question Easy
Question 7
Q204 - Basics
What HTML tag is used to indicate that we are embedding JavaScript code?
-
A
- <javascript>
-
B
- <embedded>
-
C
- <script>
-
D
- <body>
Reveal correct answer
Correct answer: C
Explanation
Topic: HTML <script> tag
Try it yourself:
- <!DOCTYPE html>
- <html>
- <head>
- <title>Q204</title>
- <meta charset="UTF-8">
- </head>
- <body>
- <script>
- console.log("I am inside of the JavaScript-Tag");
- // I am inside of the JavaScript-Tag
- </script>
- </body>
- </html>
Explanation:
The HTML <script> tag is used to define a client-side script (JavaScript).
https://www.w3schools.com/html/html_scripts.asp
(There is a similar question Q304.)
Q204 (Please refer to this number, if you want to write me about this question.)
A. The tag is not a valid HTML tag either. There is no specific tag named that is used to indicate the embedding of JavaScript code in an HTML document. This choice is incorrect.
B. The tag is not a valid HTML tag. There is no such tag in HTML that is used to indicate the embedding of JavaScript code. Therefore, this choice is incorrect.
C. The tag is used in HTML to indicate that we are embedding JavaScript code within the HTML document. It is the correct choice for including JavaScript code in an HTML file.
D. The tag in HTML is used to define the main content of the document. It is not specifically used to indicate the embedding of JavaScript code, so it is not the correct choice for this question.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
