Reduces an array to a single value from left to right.
const words = ['Ada', 'Lovelace'];const totalLength = Arr.foldl(words, (acc, word) => acc + word.length, 0);const concat = Arr.foldl<string | number, string>( (acc, value) => `${acc}-${value}`, 'items',)(words);assert(totalLength === 11);assert(concat === 'items-Ada-Lovelace'); Copy
const words = ['Ada', 'Lovelace'];const totalLength = Arr.foldl(words, (acc, word) => acc + word.length, 0);const concat = Arr.foldl<string | number, string>( (acc, value) => `${acc}-${value}`, 'items',)(words);assert(totalLength === 11);assert(concat === 'items-Ada-Lovelace');
Reduces an array to a single value from left to right.