Maps - Remove Key
Removes the specified key and associated value from the target map variable.
Syntax
<map-variable>.remove(<key-name>);
|
where,
<map-variable> refers to the map name from where the specified key and its associated value will be removed.
<key-name> refers to the key to be removed
Example
In the following example, the key-value pair ("John", "India")
available in map1 will be removed.
map1 = map(); map1.put("John", "India"); map1.put("David", "USA"); if(map1.containKey("John")) { alert("John is lived in " + map1.get("John")); } else { alert("No Information available"); } map1.remove("John");
|