How To - Store Key Value Pair in Two Dimensional Array and HashTable using JQuery? -
Does anyone redirect me to the correct link or give an example of how to work with two-dimensional array or HashTable in JQuery ? I tried Google but did not get the answer. I want to avoid using any plugins I want to do it, store some information and get them in a happier way.
Depending on you as a key in your "hashtable", you Instead of two-dimensional array objects may want to use objects with properties.
For example:
var hashtable = {}; Hashtable ['screaming'] = ["red", "orange"]; Hashtable ['sweet'] = [["sky", "yellow", "green"];
You can also set and access values in an object using point notation:
hashtable Riding = ["red", "orange"]; Warning (hashtable.screaming [0]);
If you want to keep an eye on add key / value , then the object is the way to go:
Var hashtable = { }; Hashtable ['key1'] = 'value1'; Hashtable ['key2'] = 'value2'; Hashtable.key3 = 'value3';
Comments
Post a Comment