JavaScript Basics: Understanding Its Role, History, and Transformation

What is a programming language?
A programming language is a tool that lets you tell a computer what to do by writing instructions. Just like how we use words to communicate with each other, programming languages use specific words and rules to tell the computer what to do.
For example, you can use a programming language to make a game, build a website, or automate tasks. It’s a way to create and control software that makes computers work the way you want them to.
Compiled Languages vs Interpreted Languages
A programming language needs to be converted into machine code, which is the only language a computer understands.
In compiled languages, the entire program is translated into machine code all at once before it is run. This is done by a compiler, which creates an executable file that the computer can run directly. Once the program is compiled, it generally runs faster because the translation has already been done. Ex: C, C++, Java, Go, Swift
In interpreted languages, the program is translated into machine code line-by-line as it runs. This is done by an interpreter, which reads and executes the code directly without creating an executable file first. This means that the translation happens in real-time, which can make interpreted languages more flexible and easier to debug, but potentially slower to execute. Ex: JavaScript, PHP, Python, Ruby
Example Scenario
Imagine you have a cake recipe written in French, but you only know English. You need to make the cake, so here’s how two different approaches would work:
Compiled Language Approach
Think of this as if the entire recipe is translated into English for you all at once before you start baking. So, you get the full English version of the recipe in one go, and you can follow it step-by-step without any more help needed. This is like a compiled language: the whole program is translated into machine code before it runs, so it runs faster since the translation is done beforehand.
Interpreted Language Approach
Now, imagine you have a friend who speaks French and English. Instead of translating the entire recipe at once, your friend translates each step into English as you bake. So, you get the English instructions one step at a time while you’re working on the cake. This is like an interpreted language. the code is translated line-by-line as the program runs, so you get real-time translation but it can be slower since you need to wait for each line to be translated.
JavaScript as an Interpreted Language
JavaScript is an interpreted language, which means that its code is executed directly by the browser’s JavaScript engine, line-by-line, at runtime. This allows developers to write and test code quickly, as changes are applied immediately without needing to recompile the code. The interpreter processes the code on-the-fly, making it flexible and easy to debug.
The History of JavaScript
JavaScript was created in 1995 by Brendan Eich while he was working at Netscape Communications Corporation. Initially called “Mocha,” the language was quickly renamed to “LiveScript” and then finally to “JavaScript” to capitalize on the popularity of Java at the time.
JavaScript was designed to be a lightweight scripting language for adding interactivity to web pages. It quickly became an essential part of web development, supported by all major web browsers.
JavaScript as a Client-Side Language
In its early days, JavaScript was predominantly used as a client-side language. It was embedded directly into HTML documents and executed within the browser to manipulate the Document Object Model (DOM), handle events, and enhance user interactions without the need for server-side communication.
The Evolution to Server-Side JavaScript
In 2009, Ryan Dahl introduced Node.js, a revolutionary runtime environment that allowed JavaScript to be used for server-side programming. Before Node.js, JavaScript was primarily used for client-side scripting in web browsers.
Node.js enabled developers to write both client-side and server-side code in JavaScript, facilitating the development of full-stack applications using a single language. This significant advancement streamlined the development process, improved consistency across applications, and helped unify the development stack, transforming the way modern web applications are built and maintained.
I hope this blog has clarified what JavaScript is and how it has evolved from a simple scripting language to a full-stack powerhouse. In future posts, we’ll cover key JavaScript concepts like variables, data types, operators, and functions to build a solid foundation for your coding skills. Stay tuned for more insights and hands-on tips!
Thank you for reading😊
For more updates and to connect with me, check out my Linktree!
