ABAYTHON

Promise in JS

Promise in JavaScript

JavaScript is a single-threaded or synchronous programming language but with promises we can make it look like multi-threaded or asynchronous programming language. Imagine a function waiting for a network request to complete which takes more time. Meanwhile entire execution freezes at that time we need asynchronous operations. Prior to promises, events and callback functions are …

Promise in JavaScript Read More »

Generator in JavaScript

In ECMA2015 generators are introduced in javascript. Functions in Javascript run until return or end. Generators run until yield or return or end. Generator is a process that can be passed and resumed and can yield multiple values. It provides a new way of working with functions and iterators. Using a generator: Regular function return …

Generator in JavaScript Read More »

Hoisting in JavaScript

Hoisting is a default behavior in JavaScript and not a feature. Here it allows us to use the variables and functions before declaring it. All the declarations of variables and functions are moved to the top of the scope. In other programming or scripting languages we cannot use a variable or function before declaring it. …

Hoisting in JavaScript Read More »

== vs === in JavaScript

In JavaScript for checking equality or comparison we have two operators. Now the main difference between two operators is that == does type coercion before comparison but ==== does not convert and compares as it is. Type coercion: Type coercion is automatic or implicit conversion of one data type to another. It is similar to …

== vs === in JavaScript Read More »

Difference-null and undefined

When writing my previous article nullish coalescing operator, i learned about the differences between null and undefined. Before that i thought both are more or less same but after getting to know about falsy values in javascript. Now i know the difference between them. Null: In English the literal meaning of null is having no …

Difference-null and undefined Read More »