Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

function with .map javascript

const numbers = [2, 7, 9, 171, 52, 33, 14]
const toSquare = num => num * num

const squareNums = newNumbers => 
  newNumbers.map(toSquare);

console.log(squareNums(numbers));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #function #javascript
ADD COMMENT
Topic
Name
3+9 =