How to print hello world to console in JavaScript? Read this article if you can't solve this complex coding problem.
Last modified: 2024/09/06 02:48 PM
To solve this problem, we need to look at this beautiful picture first:
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:
for
loopIt should print Hello World!
for five times, if it didn’t, you can try to fix it by:
for (let i = 0; i < 5; i++)
tofor (let i = 1; i < 6; i++)