First, the key value of the problem:
Key-value pairs ("key = value") strings, which are often used in development;
After each key corresponding to the corresponding value, when the corresponding key is pressed, the corresponding results will be output, then how to use the program to implement it?
Two: for example:
Request: When I get the ID of the address, I want the address name corresponding to the ID to echo to the page.
Three: Specific code:
Like I got the province ID,
Drop the interface to find all the address data.
The data returned by the interface:
Defines an empty object regionobj
Then add the value to this empty pair image:
Regionobj[item.id]=item.name (Item.id is equivalent to the key value = province's ID, Item.name equals value = province's ID corresponds to the province's name field)
Recently encountered in the project to convert the object array to a key value pair,