Q. JavaScript can be written
β
Correct Answer: (D)
all of the mentioned
Explanation:
JavaScript can be written in multiple ways:
Directly into a .js file and included into an HTML page
- Example:
Directly on the server page
- JavaScript can be used in server-side environments like Node.js.
Directly into HTML pages using the <script> tag
- Example:
Thus, JavaScript supports all these methods, making (D) all of the mentioned the correct answer.
<script>
alert("Hello, JavaScript!");
</script>
<script src="script.js"></script>