Built-in Functions for Manipulating Maps
There are a few built-in functions available to you when working with maps.
len()
len() returns the number of key-value pairs in a map. This value is always a number, and it is equal to the number of keys in the map.
mapKeys()
mapKeys() returns all the keys of a map as elements of an array.
The order of elements in the array returned by mapKeys() is not guaranteed to be constant.
mapValues()
mapValues() returns all the values of a map as elements of an array.
Like mapKeys(), the order of elements in the array returned by mapValues() is not guaranteed to be constant.
mapEntries()
mapEntries() returns an array whose elements are the key-value pairs of a map. Each element is represented as an array where the first element is the key and the second is the value of the pair. The returned array is a 2-dimensional array.
Last updated