I want to map one array on to another and if they match then display the value from the second
Here is my code;
let carMakes = ["ford", "volvo", "tesla", "BMW"];
let carMakeStrings = {
ford: "Ford Motor Company",
volvo: "Volvo Cars",
tesla: "S3XY",
BMW: "BMW",
GM: "General Motors",
Jaguar: "Jaguar",
AlfaRomeo: "Fiat Chrysler Automobiles"
}
return (
<div>
<ul>
{carMakes.map((carMake, key) => {
return (
<li
key={key}
>
{carMake === carMakeStrings ? (carMakeStrings.value):("")}
</li>)
})}
</ul>
</div>
)
What I want to display is an unordered list of 4 items like this
- Ford Motor Company
- Volvo Cars
- S3XY
- BMW
Currently I think I'm completely off with this solution but I'm not sure what to research - if someone can at least point me in the correct direction of what I should be researching that would be very appreciated
carMakesentries guaranteed to be present in thecarMakeStringsarray?