I was doing some reading outside of FCC and came across this example. The line that is commented out is what I was expecting and I don’t understand how the other version works. I expect it’s some form of destructuring but not sure.
let list = [{ title: "Rad Red" }, { title: "Lawn" }, { title: "Party Pink" }];
const addColor = (title, array) => array.concat({ title });
//const addColor = (title, array) => array.concat({ title:title });
console.log(addColor("Glam Green", list));
In the line that is commented out I understand how the .concat method is passed in an object consisting of a key / value pair. The version that isn’t commented though derives that key / value pair info just from {title} which is the part that confuses me.