Javascript arrow function on Object

parts = {
	"one": [ 2, 3, 4 ],
	"two": [ 5, 6, 7 ],
	"tree": [ 8, 9, 10 ]
}

Object.keys(parts).map((part) =>
	parts[part].map((el, index) => 
		parts[part][index] = el+1
	)
);
console.log(parts);
// Result:
// { one: [ 3, 4, 5 ], two: [ 6, 7, 8 ], tree: [ 9, 10, 11 ] }

Share and Enjoy !

0Shares
0 0

Leave a Reply

Your email address will not be published. Required fields are marked *

*