1. Preface
The hash object is roughly the following method:
1) Clone (): Copies the existing hash object and returns the new hash object generated by the copy.
2) each (iterator): Iterates through the iterator of each Key-value object in the hash object, where iterator is a function of the shape functions (pair) {}, where pair is the Key-value object of the hash object.
3) Get (Key): Returns value based on key, basically similar to the Get () method of Java map.
4) Inspect (): Returns a string that shows the key-value pair of the hash object, similar to the ToString () method of Java map.
5) keys (): Returns an array of all key elements of the hash object.
6) VALUES (): Returns an array of all value of the hash object. 、
7) Merge (Otherhash): Merges the new hash object into the original hash object and returns the new hash object.
8) Set (key, value): Sets a pair of key-value pairs, similar to the put () method of Java map.
9) Toobject (): Converts a hash object into a JavaScript object, in fact the hash object and JavaScript are key-value pairs, so it is very convenient to convert each other.
Toquerystring (): Converts a hash object into a query string, which appears as a ' key1= value1&key2=value2 ' form.
One) unset (key): Removes the key-value pair corresponding to key, and returns the value corresponding to key after executing the method.
Update (object): Updates the current hash object with object.
2. Example
<! DOCTYPE Html>3. Running Results
Prototype using hash objects