Skip to main content

Command Palette

Search for a command to run...

Array , Object and Map in JS

Published
•1 min read•View as Markdown
M

Experienced Full-Stack Developer with a strong background in React.js, MongoDB, Nest.js, and Laravel. Proficient in building scalable applications and RESTful APIs, ensuring optimal performance and scalability. Skilled in implementing responsive design principles and maintaining code integrity through rigorous testing practices. Adept at collaborating with diverse teams to deliver innovative solutions and meeting project deadlines.

//Returned as an array
 return ['a','b','c']   

// Returned as an object                
 return { 1:'a' , 2:'b' , 3:'c'}

// This is as Map instance
 return { '1' => 'a', '2' => 'b', '3' => 'c' }

if I want to apply some logics on array or objects , I must to write some code for implementing our idea like (delete an element , clear all elements maybe using if condition for checking about a specific element and need to loop on each array or object before checking (These all take time and slow down my web performance..) we must take it into consideration

but There is the Map method that will create a Map instance that has a lot of useful methods that can help us like (delete , get ,clear ,set , has and other....)

U can check them here