What Is JavaScript, Really?
Most people start with React, but JavaScript is the foundation. Here is what the language actually is and where we write it.
The Essentials
- The Role of JS: If HTML is the noun (the content) and CSS is the adjective (the style), JavaScript is the verb. It provides the action and behavior.
- The Origin: Created in 1995 by Brendan Eich in just 10 days, initially to add small scripts to the Netscape Navigator browser.
- The Reach: It escaped the browser. Today, JavaScript runs on servers (Node.js), embedded devices, and serves as a compilation target for languages like TypeScript.
- Execution Environments: You can write and run JavaScript directly in the browser's developer console, inside HTML
<script>tags, or using dedicated IDEs.
I did not have a traditional computer science background before I started programming. When I first encountered JavaScript, it felt like casting spells, typing incantations that I did not fully understand just to make a website do what I wanted. But the moment you stop memorizing the spells and start understanding the language, everything changes.
The Noun, The Adjective, and The Verb
I often hear that HTML, CSS, and JavaScript are the three pillars of the web. The analogy that made this stick for me is thinking about grammar.
HTML is the noun. It provides the content and structure: the paragraphs, the headings, the things on the page. CSS is the adjective. It describes the noun, giving it color, layout, and visual hierarchy.
JavaScript is the verb. It is the action. It is what makes the page interactive, what reacts to user behavior, and what modifies the nouns on the fly. Without JavaScript, the web is a static document. With it, the web becomes a dynamic application.
A Brief History
It is funny to think about how massive JavaScript has become when you consider how it started. It was created in 1995 by Brendan Eich while working at Netscape. He wrote the first version in about ten days. Its original purpose was incredibly narrow: just to give developers a way to write small scripts that could manipulate a web page inside the browser.
Since then, it has completely escaped the browser. Through environments like Node.js, developers run it on servers and Internet of Things (IoT) devices. It has become the lingua franca of the web. So much so that other languages like TypeScript and Elm use JavaScript as a compilation target. They translate their code into JavaScript because it is the one language every browser inherently understands.
Where Do I Actually Write It?
When you are just starting out, a common point of confusion is where the code actually goes. There are a few different environments you will use:
- The Browser Console: This is already built into whatever browser you are using. If you right-click any page and select "Inspect", you will find a "Console" tab. This is a live environment where you can type JavaScript and the browser will evaluate it immediately. It is the perfect place to test quick snippets and poke around.
- Local Text Files: Just like writing an
.htmlfile, you can write JavaScript in a.jsfile or directly inside an HTML document using a<script>tag. This is where you use an editor like VS Code to build actual projects. - Online Playgrounds: Tools like CodePen or CodeSandbox give you an immediate, zero-setup environment to write HTML, CSS, and JavaScript together and see the results live.
In the beginning, the browser console is the fastest way to get immediate feedback. You type a command, press Enter, and the browser runs it right then and there. It is the best place to start making those verbs happen.
Further Reading and Watching
- MDN: What is JavaScript? - Mozilla's official breakdown of the language and how it fits into the web ecosystem.
Video:
- FrontendMasters: JavaScript First Steps - A foundational course by Anjana Vakil that covers the core primitives of the language.
Keep reading