M
M
madc0de2022-01-15 16:57:12
JavaScript
madc0de, 2022-01-15 16:57:12

What does it mean to mutate the original object?

According to the task, there is a function:

function foo(object: Indexed){
}

you need to mutate the resulting object, write values ​​​​to it, and then return it from the function

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavel Shvedov, 2022-01-15
@mmmaaak

Mutate == Modify, just change/remove existing object fields, add new ones, and return the object in return

A
Alexey Yarkov, 2022-01-15
@yarkov

function mutateObject(object) {
  delete object.a;

  return object;
}
const object = {a: 1};
const result = mutateObject(object);
console.log(result) // {}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question