2

I was looking at a solution on Codewars and I'm confused by the "=>" symbol. I thought the filter method had to take a callback function and although I can see the logic behind what's happening, I have not seen the symbol used before and can't find any reference to it on the internet.

function move_zeros(arrNum, isRight = true) {
  let zeroes    = arrNum.filter(i => i === 0);
  let nonZeroes = arrNum.filter(i => i !== 0);

  return isRight ?
    nonZeroes.concat(zeroes) :
    zeroes.concat(nonZeroes);
}
Ivan Gonzalez
  • 751
  • 1
  • 5
  • 4

0 Answers0