Say, I have array of objects:
arr = [
{path: 'mexico', name: 'mexico'},
{path: 'brazil', name: 'brazil'},
{path: 'netherlands', name: 'netherlands'}
];
What I want to achieve:
prefix = 'country/'
arr = [
{path: 'country/mexico', name: 'mexico'},
{path: 'country/brazil', name: 'brazil'},
{path: 'country/netherlands', name: 'netherlands'}
];
Is there a one liner javascript function that append the prefix country/ into the path property of all objects in the array?
perhaps, something like this: arr.append(prefix, arr, 'path');