The way to create a map (actually the practical way is the json implementation)
var a = {};
a["key1"] = "value1";
a["key2"] = "value2";
Since it is a map, there is retrieval To check whether a key exists, write
if ( "key1" in a) {
// something
} else {
// something else
}
A simple sentence to declare the key and value in the map Way:
var a = {'key1': ' value1', 'key2': 'value2'}
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn