I am trying to merge two objects into one, but i need to makes sure that the first array of objects values and key become key values of another array of objects hopefully this makes sense:
So i have a dataConstant with some info like this:
export const tileData = [
{
title: 'JS CONS',
skill: 40,
visitTitle: 'Visit JS',
visitUrl: 'https://www.google.co.uk'
},
{
title: 'JS CONS',
skill: 50,
visitTitle: 'Visit JS',
visitUrl: 'https://www.google.co.uk'
}
]
I import this const into my React component. Inside the same I am importing multiple images and put them into array of objects like so:
//the values of the objects keys are imported logos
getLogos(tileData) {
const logo = [{logo: js}, {logo: react}];
var combi = [...logo, ...i];
console.log(combi);
return combi;
}
the result of this is:
0: {logo: "/static/media/js.a672e76f.png"}
1: {logo: "/static/media/react.5513eea1.png"}
2: {title: "JS CONS", skill: 40, visitTitle: "Visit JS", visitUrl: "https://www.google.co.uk"}
3: {title: "JS CONS", skill: 50, visitTitle: "Visit JS", visitUrl: "https://www.google.co.uk"}
But I would like the first two element 0 and 1 to be inside of the 3 and 4
var combi = [...logo, ...tileData];?