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
const editSchoolName = (schools, oldName, newName) => schools.map(({name, ...school }) => ({ ...school, name: oldName === name ? newName : name }));
You could shorten it by using a ternary.