# Hello World in JS !

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1600450814535/AtBY_2Yt6.png)

# Hello World

As usual the first thing to do when you are beginning a new language : Hello World !

 [Why Hello World ?](https://en.wikipedia.org/wiki/%22Hello,_World!%22_program) 😉

In JS they are multiple different ways to do that :

- Using alert box
- Using the console
- Modifying the DOM
...

I coded for you few examples, feel free to do the same thing on your computer, you just need a text editor and a web browser to open your HTML file 👊

## Code

![html.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1600451064429/plcC5Hzw3.png)

![js.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1600451066797/8-f9lEaMm.png)

## Explanations

alert() method will open an alert box when the page is loaded containing the string that you passed in

console.log() method is logging your string as a message in the console

console.warn() method is logging your string as a warning in the console

document.querySelector("#id") is returning the DOM element with ID, and textContent will help to add text to this element 

🚀 In my next post you can see how to declare variables in JS 🚀



