Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>but... technically he was right. In JS everything's passed by value. It doesn't matter that those values are references.

yes, technically I know this but even so he was technically not right because he still said there was pass by reference and pass by value in JavaScript, it's just that the description he had of what happens in pass by value is what is normally described as "pass by reference" and the description he had of what happens in pass by reference is what is normally described as "pass by value".

I think we can agree that given that he used both terms and mixed up their meanings that he was not "technically right"

on edit: meaning if he had said "we pass everything by value in JS but some values are references, what happens then?" he would be right, but when he said we pass objects by value and primitives by reference - what do these two terms mean and then he accepted the description of what happens in an object when passing the reference as being correct but insisted that was called pass by value, and he accepted that the description of what happened with a variable when it has a string assigned and then that variable is assigned to another variable and then the first variable is changed was correct including the ability to change the value of variable A and not have the value of variable B changed thereby but insisted that this process is called pass by reference, I intuited through this conversation that he was unfortunately not "technically correct"



Should've been more clear, it was only a response to the objects passed by value part as correct. Yeah, he was obviously confused by other parts.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: