I am trying to take an array of objects like so
[
{ url: 'some url here', clickHandler: 'click handler function'},
{ url: 'some other url here', clickHandler: 'other clickHandler function'}
]
I want to pull apart the url of the object and run each url through a function that returns the modified url and return an array like this
[
{ url: 'some modified url here', clickHandler: 'click handler function'},
{ url: 'some other modified url here', clickHandler: 'other clickHandler function'}
]
I know that I want to use .map because I can iterate over the array of objects but I am unsure how to create the new array to have the same structure but just modify the url as necessary. The function is just going to return the modified url.
UPDATE: I don’t want to use forEach because the original array needs to remain intact.