Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (13.1k points)
I want to implement a hash map in a JavaScript to analyze the performance. Can anyone help me how I can able to do that?

1 Answer

0 votes
by (26.7k points)

Basically, in JavaScript, every object is a hashmap that will accept strings or a symbol as a key. You can use the below code snippet to implement it:

var map = {};

// add a item

map[key1] = value1;

// or remove it

delete map[key1];

// or determine whether a key exists

key1 in map;

I hope this will help.

Want to know more about Java? Prefer this tutorial on Learn Java.

Want to become a Java Expert? Join Java Training now!!

Related questions

0 votes
1 answer
asked Sep 25, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...