Imran Alam has Published 54 Articles

How to create a chessboard pattern with JavaScript and DOM?

Imran Alam

Imran Alam

Updated on 03-Aug-2022 12:02:51

With a little bit of JavaScript and DOM manipulation, you can create all sorts of interesting patterns on a webpage. In this tutorial, we'll show you how to create a chessboard pattern using JavaScript and the DOM.ApproachSTEP 1 − We start by creating a element with an id of ... Read More

Difference between Local Storage, Session Storage, and Cookies in JavaScript

Imran Alam

Imran Alam

Updated on 29-Jul-2022 08:20:15

 JavaScript provides three mechanisms for storing data on the client − cookies, session storage, and local storage. Each one has advantages and disadvantages.Local storage is the most recent mechanism. It allows for larger amounts of data to be stored, but the data is not deleted when the browser is closed. ... Read More

Difference between Function.prototype.apply and Function.prototype.call in JavaScript

Imran Alam

Imran Alam

Updated on 29-Jul-2022 08:17:33

Function.prototype.apply and Function.prototype.call are methods that allow you to call a function with a specific this value and arguments. The main difference between the two is that apply lets you pass in an array of arguments, while call requires you to list the arguments one by one.Function.prototype.applyFunction.prototype.apply is a method ... Read More

How to convert a 2D array to a CSV string in JavaScript?

Imran Alam

Imran Alam

Updated on 21-Jul-2022 14:34:55

The CSV (Comma Separated Values) file format is a popular way of exchanging data between applications and data stores. The CSV file format is simple and easy to understand, and many applications and programming languages support it.In JavaScript, there are a number of ways to convert an array of data ... Read More

How to apply function against an accumulator and each key of object in JavaScript?

Imran Alam

Imran Alam

Updated on 02-Jul-2022 07:41:00

In JavaScript, We can use the reduce() method to apply a function against an accumulator and each key of an object (from left to right).The reduce() method is called on a given array and takes in a callback function as its first argument. Please refer to Array reduce() for more ... Read More

How to get the sum of the powers of all numbers in JavaScript?

Imran Alam

Imran Alam

Updated on 02-Jul-2022 07:38:44

In this tutorial, we'll be discussing how to get the sum of the powers of all the numbers from start to end in JavaScript. We'll be using the built-in Math.pow() method to calculate the powers and the Array reduce() method to sum up the values.Using the Math.pow() methodThe Math.pow() method ... Read More

How to convert array of strings to array of numbers in JavaScript?

Imran Alam

Imran Alam

Updated on 02-Jul-2022 07:22:16

In JavaScript, there are different ways to convert an array of strings to an array of numbers. The first way is to use the built-in parseInt() method, and the second way is to use a type conversion function, and the third one is to use the unary + operator.Using the ... Read More

How to return a passed string with letters in alphabetical order in JavaScript?

Imran Alam

Imran Alam

Updated on 01-Jul-2022 13:42:27

We could apply String split(), Array sort() and Array join() methods to write a function that returns a passed string with letters in alphabetical order in JavaScript. A JavaScript function is a block of code that is executed when it is invoked. A string is a sequence of characters. In ... Read More

What is difference between unescape() and escape() functions in JavaScript?

Imran Alam

Imran Alam

Updated on 01-Jul-2022 13:08:25

JavaScript provides two functions for dealing with encoded strings: escape() and unescape(). The escape() function is used to encode a string, making it safe for use in a URL. The unescape() function is used to decode an encoded string.The differencesThe main difference between the two functions is that escape() encodes ... Read More

What is the difference between undefined and not defined in JavaScript?

Imran Alam

Imran Alam

Updated on 01-Jul-2022 13:04:34

In JavaScript, there are two main ways that a variable can be "undefined". The first is when you declare a variable without giving it a value. The second is when you try to access a variable that does not exist.Undefined in JavaScript When a variable is declared without a value, it ... Read More

Advertisements