Abhishek Kumar

Abhishek Kumar

14 Articles Published

Articles by Abhishek Kumar

Page 2 of 2

How to use associative array/hashing in JavaScript?

Abhishek Kumar
Abhishek Kumar
Updated on 15-Mar-2026 662 Views

We use Object and Map classes to mimic the behavior of associative array/hashing in JavaScript. JavaScript doesn't provide an associative array built-in. The closest similar behavior we get is from the Map class in JavaScript. Let us look at them one by one. Object Class in JavaScript The object class allows us to create objects with name-value pairs. This is similar to hashing as the object knows which property is associated with what value. Syntax const obj = { name : "Abhishek", age : 22 } var name ...

Read More

How to use Spread Syntax with arguments in JavaScript functions?

Abhishek Kumar
Abhishek Kumar
Updated on 15-Mar-2026 2K+ Views

We use the Spread Syntax of JavaScript to expand an array, string, or object in place. Such types of values are called iterable. This is similar to destructuring the iterable in place. Its utility in a function call allows us to extract function parameters from an iterable. In this tutorial, we learn how to use Spread Syntax with arguments in JavaScript functions. Spread operator in JavaScript A Spread operator, denoted with (...) followed by the name of the iterable expands the iterable into its constituent elements. Example of spread in destructuring: const [x, y, ...z] ...

Read More

How to use a line break in array values in JavaScript?

Abhishek Kumar
Abhishek Kumar
Updated on 15-Mar-2026 15K+ Views

We use the join() method of JavaScript to use a line break in array values. It allows us to concatenate all the constituent elements of an array into a single string using a common separator. The join() method in JavaScript The join() method takes as input a single separator string and returns a string with all the elements of the array separated by the specified separator string. The separator string by default is the comma(, ). The join method uses the toString() method to convert the elements of the array into corresponding strings. A null or undefined ...

Read More

How to use 'const' keyword in JavaScript?

Abhishek Kumar
Abhishek Kumar
Updated on 15-Mar-2026 3K+ Views

We use the const keyword in JavaScript to declare variables whose value can be initialized only at the time of declaration. It is similar functionality of declaring variables as the other keywords provided in JavaScript i.e. var and let. const is short for constant, meaning that the value that resides in the variable is unchangeable. The const keyword in JavaScript It is used to declare variables in JavaScript. The variables created using const follow certain rules. The variable is block scoped. This means that the scope(lifetime) of the variable depends on the place ...

Read More
Showing 11–14 of 14 articles
« Prev 1 2 Next »
Advertisements