FAQ: Code Challenges: Intermediate JavaScript - squareNums()

Hello! This is my version of code:

const numbers = [2, 7, 9, 171, 52, 33, 14]

const toSquare = num => num * num;

const squareNums = (arr) => {

      var newArr = arr.map(function(num) {

        return toSquare(num);

      });

      return newArr;

};

console.log(squareNums(numbers));