JavaScript – Object Oriented Programing

Object Oriented Programing means bringing together the data and the behavior in a single location called an object. data and behavior are the 2 main things in programs. data means the things we keep in memory and behavior means functions, the things that programs can do. This paradigm is entirely different than the functional programming paradigm that keeps a separation between the data and behavior.

Continue reading “JavaScript – Object Oriented Programing”

Asynchronous JavaScript

Javascript is single-threaded, only one statement is executed at a time. If something in our code is a long process it will freeze our application (block the thread) until it finishes. But as I explained in my previous articles, JavaScript does not work alone in the browser, we have the web API which is a set of features that help us run code asynchronously, a code that runs with callbacks in the background and does not freeze our application.

Continue reading “Asynchronous JavaScript”

JavaScript – Functional Programing

Functional programming is all about separation of concern which object-oriented programing does as well. but in functional programming, we don’t combine the data and functions in one piece or one object like with object-oriented programming. the functions operate on well-defined data structures like arrays and objects rather than belonging to the data structure like an object.

Continue reading “JavaScript – Functional Programing”

JavaScript – The Story Of The 2 Phases

There are 2 phases when JavaScript starts to run, and they are called the creation phase and the execution phase. in the creation phase, JavaScript goes over the first time over the code and arranges it in memory. in the execution phase, JavaScript goes again over the code and runs it.

Continue reading “JavaScript – The Story Of The 2 Phases”

JavaScript Runtime

The JavaScript engine and the JavaScript runtime are responsible for running JavaScript code, the JavaScript engine alone will freeze the page as long as the call stack is not empty. it means that the JavaScript engine is synchronous. but with the JavaScript runtime, we can run asynchronous code.

The JavaScript runtime is a set of features that exists in the browser and while the JavaScript engine runs our code synchronously, the browser works in the background.

Continue reading “JavaScript Runtime”