This article is so useful, cause I recently had an array with something like arr = [ {name: foo, count:2}, {name2: doe, count:5} ] and I wanted to convert all count values to percentage while maintaining names as they're and get results into a new array, I think the add function and dynamic object trick you have provided here can make it work, I just haven't figured it out. But in all this is awesome, thanks!
Chety
Solving everyday problem by code
Hey Yogesh Chavan
Good tips thanks. By the way, I can add my two cents to your article.
arr.slice(-1)will return[50]not the value50.const isArray = Object.prototype.toString.call(arr) == "[object Array]"