E
E
EVGENIY ARAPOV2019-10-30 23:54:14
JavaScript
EVGENIY ARAPOV, 2019-10-30 23:54:14

Why doesn't this function output an array of positive integers raised to the power of 2?

const squareList = (arr) => {
  arr.filter(elem=>
  Number.isInteger(elem)&&elem>0)
  .map(elem=>Math.pow(elem, 2));
  return arr;
  
};

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question