I am trying to code this in ES6. Below is what I am trying to achieve. Let\'s say I have an array of objects called schools.
schools
let schools = [ {na
You need to return the updated object:
const editSchoolName = (schools, oldName, name) => schools.map(item => { if (item.name === oldName) { return {...item, name}; } else { return item; } });