Computer Science, asked by Diya84421, 1 year ago

How to write "Hello, World!" program in JavaScript?

Answers

Answered by amalraj142003
1

JavaScript programs can be inserted into any part of an HTML document with the help of the <script> tag.

For instance:

<!DOCTYPE HTML>

<html>

<body>

<p>Before the script...</p>

<script>

alert( 'Hello, world!' );

</script>

<p>...After the script.</p>

</body>

</html>

You can run the example by clicking the “Play” button in the right-top corner of the box above.

The <script> tag contains JavaScript code which is automatically executed when the browser processes the tag.

mark it as a brainlist

Answered by AskewTronics
0

Below are the code and the output in JavaScript for the above question:

Output : "Hello, World!"

Explanation:

document.write("\"Hello, World!\"") //It is used to displayed the ""Hello, World!"" in the display.

Code Explanation :

  • The above-defined one line javascript code is used to display the output which is a demand by the question by the help of document.write function.
  • when any string is passed to print the message by the help of this function then the string is appended by the help of double-quotes.
  • But when the double quotes also need to print as the output, then '\' is used to hide the one double quotes on the string as written in the program.

Learn More :

  • Java script : https://brainly.in/question/8809216
Similar questions