I'm trying to calculate the sum of the height of a couple elements in the page using map & reduce. For unknown reasons this is throwing me the following exception:
VM52933:2 Uncaught TypeError: $(...).map(...).reduce is not a
function(…)
$('.items')
.map( (index,slide) => $(slide).height() )
.reduce( (prev, next) => prev + next, 0 )
.map returns a valid array:
[48, 48, 48, 75, 48]
If i do the map separately ( [48, 48, 48, 75, 48].reduce(...) ) it works.
What am I doing wrong here?