Introduction to JavaScript

Why do we need JavaScript?

Static web sites cannot do as much as interactive web sites can. Which means that we need a language that all major web browsers can understand and execute. That leaves one option: JavaScript.

The page you are looking at right now mostly works without JavaScript as well, but with JavaScript enabled (default on all major browsers) you can do a lot more. You can navigate to other pages while only fetching the new content of the page you clicked on and maintaining the rest of the layout and content. You can complete interactive code challenges and see a live preview of your code right next to it.

With JavaScript we can create interactive charts, maps, games and almost whatever else you can think of.

Simple HTML/CSS button

With JavaScript

Here we have added JavaScript that changes the color of button every time we click it.