Logo

Programming-Idioms

  • Obj-C
  • Js

Idiom #254 Replace value in list

Replace all exact occurrences of "foo" with "bar" in the string list x

x = x.map(e => e === 'foo' ? 'bar' : e);
(replace {"foo" "bar"} x)

New implementation...