How to chain JS promises?

Many times we have promises which needs to be executed one by one and may have data dependency from the previous promise. For example, we want to write three promises where one provides current date, second one provides date in milliseconds and third one provides the formatted date in YYYY-MM-DD format. There can be more […]

Playing with JavaScript Dates

JavaScript Date objects are not the easiest to work with. This is why many developers install different modules such as moment.js, or Luxon. Let’s say you would like to get the month, date and year from the provided Date object, you can fetch it as shown below. In JavaScript, getMonth() returns the month where January […]

Learn about JavaScript Dates

Many times, we find it hard to work with JavaScript Date, but it is still widely used. By default, JavaScript will use the browser’s time zone and displays that date. We can create Date object using the new Date() constructor. We can use this constructor by passing different values to it to generate the date […]

10 Most Important String Methods

charAt(i) – this method returns the character at the provided index of i for a string. The index starts from left at 0. length – Method returns the length of the provided string. split(delimiter,limit) -it returns an array containing each element according to the specified delimiter. limit is an optional parameter which will specify the […]

What is Hoisting in JavaScript?

Hoisting is JavaScript’s default behavior to push declarations of variables to the top of its scope. When JavaScript compiles the code, all the variables declarations are moved to the top of their global or functional scope. Hoisting does not happen inside your code but it happens when JavaScript compiles your code. Even the functions are […]

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top