What is JavaScript used for?

Javascript is a computer language so it can be used for many, many things.

But let’s focus on where JS shines. JS was developed for web pages. When you open a web page, the code that runs in the browser is a combination of HTML, CSS, and JS. HTML handles the basic layout and structure of the page and basic operations, CSS handles the styling, and JS handles more complex interactions and gives you a lot more control. Pretty much all modern web pages are going to use JS on some level. Web pages would be a lot less interesting and useful without it.

JS can also be used to write outside of a browser with environments like Node. You can write your web page’s server in JS. There are many language options for that, but Node/JS is one of them.

You can also use JS to write code that compiles down to something else, like I use React Native (a flavor of React which is a JS library) to write apps for mobile devices that don’t natively run JS.

There are other things it can be used for - but those are the places that I can think of where it shines the most.