Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Reduce "one-liner" solution in Clear category for Sum by Type by flytaly
function sumByTypes(values: Array): [string, number] {
return values.reduce(
([str, num], current) => typeof current === 'string' ? [str + current, num] : [str, num + current],
['', 0],
)
}
May 16, 2020
Comments: