Objective:
If you have read the first and second, I believe that you will have a preliminary understanding of jquery, for the jquery selector and array of operations are already familiar with, this article is a separate list of the operation of the dictionary in jquery related content.
1. Add a map to the array
var arr = []; var key = ' Jeremy '; var value = '!!!! ' arr.push ({' key ': Key, ' value ': value,}); document.write ("key:" + arr[0][' key ') + "<br/>value:" + arr[0][' value '); output: key:jeremyvalue:!!!!
2. Array traversal output
var arr = []; Arr.push ("Jeremy"); Arr.push ("Jimmy"); for (var i in arr) document.write (i + ":" + arr[i] + "</br>"); Output: 0:jeremy1:jimmy
3. Similar dictionary (map) traversal
var dict = []; or dict = new Array () dict["Jeremy"] = 20; dict["Jimmy"] = 30; for (var key in Dict) document.write (key + ":" + Dict[key] + "</br>"); Output Result: jeremy:20jimmy:30
4. Assigning values when a dictionary is declared
var dict = {"Jeremy": +, "Jimmy": 30}; for (var key in Dict) document.write (key + ":" + Dict[key] + "</br>"); Output Result: jeremy:20jimmy:30
var dict = {"Jeremy": ["Chinese", "Math"], "Jimmy": ["Art", "中文版"]}; var name = "Jeremy"; for (Var courseindex in Dict[name]) document.write (Dict[name][courseindex] + "</br>"); Output Result: Chinesemath
5. The value in the dictionary is an array, which is a dictionary.
var dict = []; var courselistofjeremy = [{"Chinese": 3}, {"Math": 5}]; dict[' Jeremy '] = Courselistofjeremy; var courselistofjimmy = [{"Art": 3}, {"中文版": 5}]; dict[' Jimmy ' = courselistofjimmy; document.write ("Jimmy's Course number of Chinese:" + dict[' Jeremy '][0][' Chinese ']); output: Jimmy's Course number of Chinese : 3
Small example: Using JS to achieve three-level linkage between counties and cities
Effects such as:
English tips:
I ache all over.
I'm aching all over.
I ' m flattered.
That's a compliment.
I ' M mad at myself.
I was angry with myself.
I ' m not myself today.
I am uneasy today.
I ' m very/really/terribly/awfully/extremely sorry.
I'm very sorry.
I ' m working on it.
I'm trying.
It can ' t be helped.
Powerless.
I can ' t seem toget to sleep.
I can't seem to sleep.
I don ' t feel.
I feel unfit for the job.
I have a runny nose.
I have a runny nose.
I have a sweet tooth.
I like to eat sweets.
[JQuery Learning Series three]3-jquery learning two-dictionary operation