length is a property; all others are methods.
| Method / Property | Returns | Description |
|---|---|---|
map.length |
Integer |
Number of key-value pairs |
map.keys() |
List |
List of all keys (in insertion order) |
map.values() |
List |
List of all values (in insertion order) |
map.has(key) |
Bool |
Whether the given key exists |
map.remove(key) |
null |
Removes the key-value pair; no-op if key is missing |
let config = {host: "localhost", port: 8080, debug: true}
print(config.length) // 3
print(config.keys()) // [host, port, debug]
print(config.values()) // [localhost, 8080, true]
print(config.has("port")) // true
print(config.has("timeout")) // false
config.remove("debug")
print(config) // {host: localhost, port: 8080}