JS was created by Brendan Eich at Netscape.
- It is a synchronous language.
- It is a JIT-compiled language.
What does single-threaded programming language mean?
Single-Threaded means at a time only a line of code can be executed, it cannot carry out things parallelly.
What is synchronous?
Synchronous means it cannot jump on to the next line of code before completely executing the previous one.
What is an interpreted language?
In Interpreted language, the code is run line by line and the result of the same is immediately returned. Whereas in compiled languages they are transformed into another form before they are run by a computer.
Read compiler vs interpreter for more detail.
On the client-side or frontend, while the HTML and CSS are used to structure and style the web page, JS enables interactivity with the website.
Actions performed when clicking a button, and zooming in on an image are some of the interactivity you see very frequently on a daily basis.
On the server-side or backend, it is used to create servers and handle the infrastructure.
How to begin your frontend or backend journey with JS?
In the backend side, we can directly jump to a framework of Node.js called Express. (Python and Node.js are two popular choices for backend development.)
Don’t worry. You don’t need to do any setup by yourself. Every browser has its own JS engine.
- Google Chrome has V8
- Mozilla has SpiderMonkey
- Edge has Chakra
Fun Fact: The one who founded the JS, Brendan Eich also created the first JS engine and today that engine is SpiderMonkey.
What happens inside the JS Engine?
In the JS engine majorly three steps take place:
In the Parsing phase, the code is broken down into tokens and then a syntax parser converts it to an Abstract Syntax Tree which is passed down to the compilation and execution phase.
The compilation Phase and the Execution phase goes hand in hand.
Alternatives to JS
Here are some Languages that are transpiled (somewhat similar) to JS.
TypeScript has become very famous and many companies have started to shift to it because of its nature of being strictly typed. Once you understand the fundamentals of JS and how it works it will be easy for you to understand the need for TypeScript.
That’s all about this tutorial folks. See you in the next tutorial. If you have any questions, feel free to ask in the comment section below.