In JavaScript and many other programming languages, variables are references to a value. By the Transitive Law of Logic and Mathematics, it then fo...
For further actions, you may consider blocking this person and/or reporting abuse
Unless I'm missing something here this is absolutely untrue and I'm not sure what it is you were trying to say. Referencing isn't transitive in the first place and even if it were, if you want equivalence you also need reflexivity and symmetry.
I think the memory graph is confusing,
went
should point to'to'
, not todev
. Admittedly there's little difference withconst
values.Other than that good writeup, many beginners struggle with this when exposed to mutability.
Yes, I'm aware that
went
should point to'to'
. I only made it pointdev
for simplicity's sake, really. I hope it's still understandable nonetheless.And regarding the Transitive Law, I was just trying to say that believing "references are values because variables are references to a value" should be avoided. Sorry if that didn't come out right.
Anyway, thanks for pointing (See what I did there?) this out.
I would then argue in favor of rewording that sentence. The reason being that it might confuse people about what transitivity is (i.e. a property of a specific relation).
A reference to Frege's "Über Sinn und Bedeutung" might be a better fit.
nice one
Oh, wow. This is some deep philosophical stuff.
It is, though I must admit I personally detested the subject as I have very different views about what language is. But that's going way too far for a value/reference discussion :P
Anyway, all jokes aside, I appreciate how you brought up the limitations and flaws of my article. Hopefully future readers will note your points. Thanks!
Congratulations! This is a very useful reference for people starting to learn JavaScript.
Thank you so much! I really try my best to write informative articles.
This is a useful and excellent reference article you wrote.
As someone who is learning Javascript, this behavior seems like a truly frustrating bug waiting to happen. A referencing operator as a hint would have been nice. Thanks for explaining.
Don't worry about it, my friend. You wouldn't really encounter anything frustrating from it. At least from my experience with JavaScript, I haven't had any problems with it. I think it stems from the fact that I try my best to be aware of my memory usage. Nonetheless, there is nothing to worry about. I promise that. Unless you are really trying to break your program/script, you won't break anything at all.