News for hackers. Stuff that matters.
Re:Deep-copying in JavaScript by pjmlp on Thursday January 25, 2018 @03:58PM (#16234604)
Wrong from CS point of view, references are also pass-by-value on JavaScript.

If JavaScript allowed pass-by-referece, we would be able to do the following,

    function swap(x, y) {
        let c = x
        x = y
        y = c
    }

    let a = {a: 6, b: 7}
    let b = {c: 8, d: 8}

    swap(a, b)

    console.log(b)

    // Object {a: 6, b: 7}
Meaning, pass-by-reference means being able to actually change the "pointer" used by the local variable.
Re:Deep-copying in JavaScript by zzzcpan on Thursday January 25, 2018 @04:11PM (#16234714)
I understand what you mean, but consider this to be an incorrect view on these things. They are not about CS, but about user experience.
Re:Deep-copying in JavaScript by pjmlp on Thursday January 25, 2018 @05:08PM (#16235159)
The incorrect view is to teach wrong concepts just because some people rather learn based on gut feeling, than taking the effort to learn it properly.