This lesson will explain the solution to the problem in the previous lesson.
const func = (key, value, object) => ({ ...object, [key] : value});function test(){ const car = { name: 'Toyota' }; const answer = func('model', 88, car); console.log({car,answer});}test()
In this challenge, you had to convert the following impure function into a pure function.
const func = (key, value, object) => { object[key] = value};function test(){ const car = { name: 'Toyota' }; const answer = func('model', 88, car); console.log({car,answer});}test()
As you can see, the function updates ...