Last updated 4 years ago
Was this helpful?
const squareOrSquareRoot = (array) => array.map((v) => Math.sqrt(v) % 1 === 0 ? Math.sqrt(v) : v ** 2);