This article mainly introduces the use of JavaScript correlated arrays, and analyzes the concepts, definitions, and implementation skills of correlated arrays in the form of examples, if you need it, refer to the next article, which mainly introduces the usage of JavaScript associated array and analyzes the concepts, definitions, and traversal techniques of associated array in the form of examples. If you need it, refer
This example describes how to use Javascript to associate arrays. We will share this with you for your reference. The details are as follows:
Basic concepts:
"Join array" is an array with a special index method.It can be indexed not only by integers, but also by strings or other types of values (except NULL.The index value of the associated array is any scalar, which is called Keys and can be used later to retrieve the values in the array. The elements of the joined array have no specific order.
What does an associated array look like?
The Code is as follows:
Var defs = [W3C: "World Wide Web Consortium", DOM: "Document Object Model"];
How to define an associated array?
Var defs = []; defs [key] = value;
Note: key and value must be assigned different values.
How to traverse the associated array?
For (key in defs) {// variable key can be used directly. Var value = defs [key]; // The value of each key pair .}
The above is a detailed analysis of the usage of the JavaScript associated array. For more information, see other related articles in the first PHP community!