var color3 = {
name: 'Black',
type: 'special',
rating: 1
};
var rateColor3 = (colorName, Nrating) => ({ ...colorName, Nrating });
console.log(color3.rating); ///// 1
console.log(rateColor3(color3, 6).rating);//////1
console.log(color3.rating);//////1
I want to use object spread operator while keeping color3 immutable, But the output of my 2nd console.log is 1 instead of 6, what am i doing wrong?