• (nodebb)

    The function is also incorrectly named, because, in essence, it merges the "new" object into the "old" object. (It fails to clear the old object before adding the values from the new object to it.)

  • (nodebb)

    If you're going to re-invent the wheel, shouldn't you make one that's substantially better, not substantially worse?

    I mean, judging by this website, people tend to do the latter, but still...

  • (nodebb)

    The thing that really irks me about this though is that it pretends to be functional (in the programming idiom sense) by returning the newly modified value, but it's also just changing that value in place because it's a reference. So it has side effects, in a technical sense (changing the value of its input parameters) while pretending not to.

    To be fair, non functional style methos that mutate their single argument often return the instance. By returning the instance rather than void, the caller can chain method calls. It isn't fair to assume they meant to mimic functional programming.

  • (nodebb) in reply to Jaime

    To be fair, non functional style methos that mutate their single argument often return the instance.

    Like the built-in Array.sort.

Leave a comment on “Copied Homework”

Log In or post as a guest

Replying to comment #687678:

« Return to Article