Apologies for what may seem like a trivial issue, but I'm struggling to find a solution for the following problem:
I have an array that contains the following elements:
0: "A"
1: "B"
2: "C"
My goal is to use the map() function to transform it into an array like this:
0: {name: "A"}
1: {name: "B"}
2: {name: "C"}
When I try using either of these methods:
this.xxx = this.operations.map(obj => obj.name);
console.log(this.xxx);
or this:
this.xxx = this.operations.map(obj => {name:obj} );
console.log(this.xxx);
I encounter an issue where the elements of xxx are coming up as undefined.