Closed Bug 1514877 Opened 7 years ago Closed 7 years ago

Request for clarity around target mutation

Categories

(Developer Documentation Graveyard :: JavaScript, enhancement, P2)

All
Other
enhancement

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: dehuszar, Assigned: wbamberg, NeedInfo)

References

()

Details

:: Developer Documentation Request Request Type: Correction Gecko Version: unspecified Technical Contact: :: Details The first example given does not describe the mutation of the first argument were that argument to be an existing variable. Without reading the rest of the document, a reader could miss this detail. While reading the entire document is always encouraged, the "above the fold" example(s) should always guide the reader towards best practices. I would recommend an example like: const object1 = { a: 1, b: 2, c: 3 }; const object2 = {c: 4, d: 5}; const object3 = Object.assign(object1, object2); console.log(object3.c, object3.d); // expected output: 3 5 console.log(object1) // expected output: { a: 1, b: 2, c: 4, d: 5 }
Hello dehuszar, Would you have the time to make a pull request to https://github.com/mdn/interactive-examples/blob/master/live-examples/js-examples/object/object-assign.html in order to improve the example in the way you suggested? If there is anything blocking you, please let me know so that we can fix that :)
Flags: needinfo?(dehuszar)
Priority: -- → P2

PR was filed for this (https://github.com/mdn/interactive-examples/pull/1273), although I decided it wasn't needed in the interactive-examples. But we could add it into the main "Examples" section.

Assignee: nobody → wbamberg

Closing; this is now tracked at https://github.com/mdn/sprints/issues/961

Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.