- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to write "Hello, World!" program in JavaScript?
JavaScript can be implemented using JavaScript statements that are placed within the <script>... </script>.
You can place the <script> tags, containing your JavaScript, anywhere within your web page, but it is normally recommended that you should keep it within the <head> tags.
Let us take a simple example to print out "Hello World". We added an optional HTML comment that surrounds our JavaScript code. This is to save our code from a browser that does not support JavaScript. The comment ends with a "//-->".
Here "//" signifies a comment in JavaScript, so we add that to prevent a browser from reading the end of the HTML comment as a piece of JavaScript code. Next, we call a function document.write, which writes a string into our HTML document.
<html> <body> <script> <!-- document.write("Hello World!") //--> </script> </body> </html>
- Related Articles
- How to write "Hello, World!" program in JavaScript?
- How to write "Hello World" Program in C++?
- How to write "Hello World" in C#?
- Write a program to display "Hello World" in react native?
- How to write first Hello World program using CGI programming in Python?
- C++ "Hello, World!" Program
- Hello World Program in Java
- Hello World program in Kotlin
- Python Program to Print Hello world
- Creating Java Hello World Program
- Analysis of Java "Hello World" Program
- Internal Analysis of Java "Hello World" Program
- How to create Android Hello World App?
- How to print "Hello World!" using Python?
- A closer look at Java "Hello World" program
- Hello World in Dart Programming

Advertisements