Author: saqibkhan
-
Timing Events
What are the Timing Events? JavaScript timing events are used to execute the code after a specified time only once or multiple times. In JavaScript, you can use the timing events to control when a particular task should be executed. The ‘window’ object contains the various methods for timing events, which you can use to…
-
Promises Chaining
The promise chaining in JavaScript can handle multiple related asynchronous operations even with a single promise. While a single promise handles a single asynchronous operation, the promise chaining allows you to create a sequence of promises. Here success or rejection of one promise triggers the execution of the next promise. This enables you to handle multiple asynchronous operations. In…
-
Promisification
Promisification in JavaScript Promisification in JavaScript is a concept to convert the callback functions into a regular function, returning the promise. The reason to convert the callback functions into promises is that when you need to write the nested callback functions, it increases the complexity of the code. So, you can write a function returning…
-
Microtasks
Microtasks in JavaScript are small functions that are executed after the completion of the function or program code that creates them and if the JavaScript execution stack is empty. Microtasks are executed before any macrotasks, such as setImmediate() and setTimeout(). Microtasks are used to implement features such as promises. JavaScript is a single-threaded programming language.…
-
Async/Await
The JavaScript functions defined with the async/await keyword can perform the same task as promises with fewer lines of code, and it makes the code readable. The promise’s syntax is a bit complex, so the async/await syntax is introduced. To use async/await, we need to define an aync function first. For this we write async before function…
-
Promises
What is Promise in JavaScript? A JavaScript promise is an object that represents the completion or failure of an asynchronous operation. It employs callback functions to manage asynchronous operations, offering a easier syntax for handling such operations more easily. A promise object can created using the Promise() constructor. The promise constructor takes a callback function…
-
Callback Functions
What is the Callback Function? The callback function in JavaScript is regularly passed as an argument of another function. Dont consider the callback as a name or keyword here. The callback function name can be any valid identifier. The callback function can be called inside the parent function after completing the particular task in the…
-
Asynchronous JavaScript
Asynchronous JavaScript is a programming technique that enables your program to start a potentially long-running task and continue to executing other tasks parallelly. JavaScript is a single-threaded programming language. It means you can execute a single script or particular code at a time. JavaScript control flow moves the line by line and executes each line…
-
ECMAScript 2022
The ECMAScript 2022 standard was released in 2022. Important features added to this update include private methods and fields, Array at() and String at() methods etc. This chapter discuss all the newly added features in ECMAScript 2022. New Features Added in ECMAScript 2022 Here are the new methods, features, etc., added to the ECMAScript 2022 version of JavaScript. Here, we have explained…
-
ECMAScript 2021
The ECMAScript 2021 standard was released in 2021. ECMAScript 2021 brought many notable features to JavaScript. The introduction of the String replaceAll() method simplified global string replacement. Logical Assignment Operators, (&&=, ||=, and ??=), enhanced code conciseness. This update focused on improving developer productivity and code readability. This chapter will discuss all the newly added features in ECMAScript 2021. New Features…