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

9 lines
226 B
Markdown

### Square The Data
Use mapObject to return a object from array passed as an argument which gets sqaured as math operation
```js
const squareIt = arr => mapObject(arr, a => a*a)
squareIt([1,2,3]) // { 1: 1, 2: 4, 3: 9 }
```