Complete the code to get the value of the key 'color' from the map.
$theme: ("color": blue, "font": "Arial"); $value: map[1]($theme, "color");
The map.get() function retrieves the value for a given key from a map.
Complete the code to add a new key-value pair to the map.
$settings: ("width": 100px); $settings: map[1]($settings, "height", 200px);
The map.set() function adds or updates a key-value pair in a map.
Fix the error in the code to check if the map contains the key 'font'.
$style: ("color": red, "font": "Helvetica"); $exists: map[1]($style, "font");
The map.has-key() function checks if a key exists in a map and returns true or false.
Fill both blanks to create a new map with only the keys from the original map.
$colors: ("primary": #ff0000, "secondary": #00ff00); $keys: map[1]($colors); $new-map: map[2]();
map.keys() returns all keys from a map.map.remove() with no arguments creates an empty map.
Fill all three blanks to create a new map with uppercase keys and original values for keys with values greater than 10.
$data: ("a": 5, "b": 15, "c": 20); $new-map: ( [1]: [2] for [3] in map.keys($data) if map.get($data, [3]) > 10 );
Use to-upper-case to convert keys to uppercase.
Use map.get($data, key) to get the value.
Use key as the loop variable.