Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create HashMap in a JS file (in JQM)

I am developing a mobile app using JQuery Mobile. Wanted to know whether can i create a HashMap the way we can do it in JAVA, in JQuery Mobile?

If yes, then how? please if possible provide me some example.

like image 233
Prals Avatar asked Dec 06 '25 17:12

Prals


1 Answers

In plain Javascript it is possible to create something very similar to a java HashMap:

var hashmap = {};

Put something in it:

hashmap['key'] = 'value';

Get something out of it:

var value = hashmap['key'];

For most purposes this will do, but it is not exactly the same as a hashmap, see for example this question: JavaScript Hashmap Equivalent

like image 104
Erik Horlings Avatar answered Dec 10 '25 01:12

Erik Horlings