Files
30-seconds-of-code/snippets/sqaure_it.md
2017-12-17 22:13:10 +05:30

226 B

Square The Data

Use mapObject to return a object from array passed as an argument which gets sqaured as math operation

const squareIt = arr => mapObject(arr, a => a*a)
squareIt([1,2,3]) // { 1: 1, 2: 4, 3: 9 }