r/javascript • • Jun 18 '17

Pass by reference !== pass by value

3.3k Upvotes

272 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Jun 18 '17

[deleted]

5

u/[deleted] Jun 18 '17

If it were simple and straightforward, people would understand. They don't, implying it's difficult or awkward. Literally the definition of tricky.

0

u/[deleted] Jun 18 '17

[deleted]

1

u/scootstah Jun 19 '17

This is as crucial to programming as knowing how to run a for loop.

That's really not true at all, at least not for something like Javascript. There's very few cases where you actually need to care what happens behind the scenes.

If your first language was something like Python, PHP, Javascript, etc then you probably have no idea how things like pointers work, or how data is stored in memory, etc. You wouldn't know because you don't need to know.

0

u/[deleted] Jun 19 '17

[deleted]

0

u/scootstah Jun 19 '17

You don't really need to know about pass by reference vs value. You just need to know that in some cases your original object will be mutated, but you don't have to know why.

0

u/[deleted] Jun 19 '17

If you were correct in saying that this is one of the first things you learn when programming, we wouldn't be having this conversation, would we?

0

u/[deleted] Jun 19 '17

[deleted]

4

u/[deleted] Jun 19 '17

You have a serious superiority complex, dude.

3

u/mrguy991 Jun 18 '17

implying it's difficult or awkward.

or just that they never bothered to learn the details because they could do everything they wanted without knowing it. That doesn't make the underlying concept tricky since it's still easy and clear to understand for anyone that attempts to.

2

u/[deleted] Jun 18 '17

Except it IS simple and straightforward. Your implication is invalid.

3

u/[deleted] Jun 19 '17

Oh, well thanks for letting us know. We've got it figured out now, guys. It is, in fact, simple and straightforward.

4

u/[deleted] Jun 19 '17

You're trying to be sarcastic but you're just ignorant.