JSFiddle - React, Tailwind, and code Playground
by Eugen Sunic
CSS
body {
background-color: #222;
}
#text {
color: #0f0;
font-family: 'Courier New', Courier, monospace;
width: 1000px;
height: 1000px;
padding: 25px;
}
JavaScript
arr = [{
name: 'car1',
position: 1
},
{
name: 'car2',
position: 2
}
]
const result = arr.map(x => {
if (x.name === 'car1') {
return {
name: x.name,
position: 10
}
}
return x;
});
console.log(result)