Cover for article How to print Hello World?

How to print Hello World?

How to print hello world to console in JavaScript? Read this article if you can't solve this complex coding problem.

Last modified: 2024/07/26 08:11 AM

To solve this problem, we need to look at this beautiful picture first:

Handsome Mr.Rick

Handsome Mr.Rick

If you want to ask if this image is relevant to this article, it is.

So how to print Hello World! in console? You can try out this simple code snippet:

console.log("Hello World!");

You could also print multiple lines of Hello World using for loop. We will discuss for loop in future blog posts that won’t be written at all.

for (let i = 0; i < 5; i++) {
  console.log("Hello World!");
}

Here is how it works:

  1. First, it runs the for loop
  2. Second, it works.

It should print Hello World! for five times, if it didn’t, you can try to fix it by:

  • Change
    for (let i = 0; i < 5; i++)
    
    to
    for (let i = 1; i < 6; i++)
    
  • Or ask ChatGPT at ChatGPT website