I'd like to create an array of objects based on the length of another object:
let initial_array = ["a", "b", "c"]
Desired Output
[
{width: "5%"},
{width: "5%"},
{width: "5%"}
]
What I've tried
I thought I could maybe use a map or forEach to create the repeating object for the length of the initial array but have failed (I'm trying to avoid using a for loop but maybe I need to?)
This doesn't work
initial_array.map(x => {width: "5%"} );