Javascript is a high-level programming language that is used on both client-side and server-side.
JS was created by Brendan Eich at Netscape.
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.
What is JIT in JavaScript?
Javascript when developed was purely an interpreted language. But in modern javascript, we have a combination of both interpretation along with compilation and a new term came which is called Just In Time Compilation
Note: The above are the characteristics of Javascript language and one should be clear about them. They are often asked in job interviews.
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.
Here are some of the use-cases of JavaScript
On the server-side or backend, it is used to create servers and handle the infrastructure.
Fun Fact: Initially JS was called LiveScript but it later got changed as Java was gaining popularity at that time so they named it as JavaScript.
In the front-end, we can use pure javascript to integrate with HTML and CSS and this is often referred to as Vanilla Javascript. Some of the most popular front-end frameworks that are built on JS are React, Vue, and Angular.
Note: It is very important to get a good grasp of the fundamentals of Javascript before jumping on to frameworks.
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.)
To run a javascript code we need a Javascript runtime environment. A javascript runtime environment consists of a JS engine, related API, callback queue, microtask queue, and a lot more stuff.
Don’t worry. You don’t need to do any setup by yourself. Every browser has its own JS engine.
Fun Fact: The one who founded the JS, Brendan Eich also created the first JS engine and today that engine is SpiderMonkey.
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.
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.