What is JavaScript used for?

I have a huge question. A question that may be considered super ‘noob’ or ever a ‘dumb’ or genuinely ‘stupid’ BUT, I’ve looked and researched this and still haven’t found an answer. Hopefully this can help clear thing up for not just me but also other newbies just getting started in Javascript.

Question is: what is JavaScript used for? HEAR ME OUT. I’ve looked at many videos, I own ‘Head First JavaScript’, and I’m about halfway through it. I’ve googled this… but I still REALLY have no idea what JavaScript is used for in a PRACTICAL sense. like, I get it can be used to create tic tack toe or pong or even alerts(). I understand that it controls the ‘logic’ of a website. But what I’m having a hard time wrapping my head around is how can I apply it in a practical sense. From a front end developer perspective.

Does that make any sense?

When I look up “what is Javascript used for” I usually get a bunch of abstract articles and videos relaying that “Javascript is used to create loops and variables etc”. SUPER abstract concepts for someone just beginning to learn.

It may sound like a crazy question. But I really don’t see how for example, me having a static portfolio style website or say, a blog site; how that could then use JavaScript in a practical way to enhance or add anything to the design or usability of it.

Lol crazy I know, but that’s one thing that I feel has really been bugging me and stunting my progression of learning JS because I don’t understand how the loops and ifs and whiles even play a practical role in creating a webpage from a front end perspective.

I kinda feel embarrassed even asking this question. but ANY help on this would be greatly appreciated. I really think that once I understand how Javascript is used, or rather; what it is used for in a more practical sense, I will be much further along in my understanding of the concepts of it.

Thanks in advance for any help.

1 Like

JavaScript make pages interactive
as in, it can target html elements and change them, it can listen for events (like a click or a key press) and react to them

1 Like

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.


And btw, don’t feel embarrassed for asking - there are going to be at least a dozen people that read this that were wondering the same thing but were too chicken to ask. Every one of us at some point didn’t know what JS was for.

1 Like

If you have a run through this course it should hopefully give you a better understanding of how JS is used in a practical sense.

A lot of the freecodecamp curriculum content is a bit abstract and out of context in this regard, it plunges straight into the language for quite a long time without showing how it’s used in a web application.

I felt the same way when I started learning and I’m sure a lot of people do, it’s part of the normal learning curve.

1 Like

Thanks a bunch for all of your answers. Yeah the abstract nature of programing languages I feel often neglect the explanation of the pragmatic approaches of their implementations. Im really glad that im not the only one that feels this way In the beginning. I will defiantly check out the course. Im still a little foggy on the understanding of it all but just reading everyones comments has started to clear things up a bit.

thanks again.

Thanks so much. I really thought it was just me hitting a gap in my understanding or just fundamentally not ‘getting’ Javascript. good to know that this is relatively normal.

Oh heck no. This is complicated stuff - if it was easy, it would pay minimum wage. Most people will run into confusion at a few (if not many) points. Ask away. Search first (an important skill for a dev) but if you can’t find it, ask away.


Just returning to this post to help anyone that may have the same question as me at the time of posting this. I found this video series and its really helping me understand what javascript is and how it works. For me its really crazy how one can potentially read books (headfirst Javascript and Eloquent Javascript) for weeks, watch videos and videos on how to learn JS, do independent research etc. and still not understanding the practical applications or its roll in the HTML-CSS-Javascript triangle.

Well for anyone like me and who may stumble across this; this video series and video in paticular really helped me understand how Javascript works and how it plugs into the world of web design :+1: