There are times that we need to change the context of the ‘this’ keyword. since functions are objects and they have properties, we can set them and access them. with ‘call’, ‘apply’ and ‘bind’ we can change the ‘this’ keyword, and we can change the context in which the function is invoked.
Continue reading “JavaScript – Let’s Change This”Category: JavaScript
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”JavaScript Engine
The job of the JavaScript engine is to translate the JavaScript code that we write into something that the computer can understand which is 0 and 1.
There are a lot of JavaScript engines and one of them is the V8 engine by google (written in C++) which was released in 2008. Google had a problem with the basic engines that ran google Maps slowly so they created their engine. the result was an advanced engine that ran the JavaScript code faster.
Continue reading “JavaScript Engine”