Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Arnab Chakraborty
3 articles
How to use finally on promise with then and catch in Javascript?
JavaScript asynchronous programming uses promise objects that don't block execution but signal when operations complete. Promises can either resolve successfully or reject with an error. The finally() method executes cleanup code regardless of the promise outcome, similar to finally blocks in synchronous try-catch statements. Syntax promise .then(result => { // handle success }) .catch(error => { // handle error }) .finally(() => { // ...
Read MoreHow to Create GUID / UUID in JavaScript?
A Globally Unique Identifier (GUID) or Universally Unique Identifier (UUID) is a 128-bit value used as a unique identifier in software development. It's typically represented as a 32-character hexadecimal string with hyphens, like: de305d84-75c4-431d-acc2-eb6b0e5f6014. Here are several JavaScript methods to generate GUIDs/UUIDs. Using Random Number Generation The most common approach uses Math.random() to generate a UUID v4 format: function generate_uuidv4() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var uuid = Math.random() * 16 | 0, v = c == 'x' ? uuid : (uuid & 0x3 ...
Read MoreHow to enable a strict mode in javascript?
In JavaScript, there are two different programming paradigms. The sloppy mode, sometimes referred to as the simple mode, is activated by default. We don't have to write the code strictly according to guidelines in this manner. On the other side, there is also the strict mode. This setting allows the environment to have some rigid constraints. Strict mode has different semantics than regular code and is not a subset of sloppy mode. This article will explain how to enable strict mode in JavaScript and will also go over some of the features of "Strict" Mode. Syntax Different scopes ...
Read More