Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Space, grammar

...

The filter() operator takes a function as its only argument and returns a map. The new map contains any members of the original map for which the function evaluates to true. The function given as the argument must take two arguments and return a Boolean value. The function is applied to the key and value of each member of the map in turn. The number of elements in the new map will be less than or equal to the length of the original map. For example:

Code Block
languagejavascript
themeConfluence
a = {"a": 3, "b": 4, "c": 5};
c = a.filter(function(k,v){v < 5})    // c = {"a": 3, "b": 4}
d = a.filter(function(k,v){k eq "a"}) // d = {"a": 3}

keys()

The keys() operator returns the keys of the map to which it is applied. Without an argument, the keys at the top level of the map are returned. The operator also accepts a hash path argument. For example:

...