DEV Community

Discussion on: Javascript uses call by sharing for objects

Collapse
 
mebble profile image
Neil Syiemlieh

You say here that:

It is commonly stated that javascript uses pass by value for objects too and that the value for objects is actually the reference of that object. That's what I thought about javascript's evaluation strategy, too. But that statement is not 100% correct either

Isn't that what call by sharing is? I found this SO answer that says the same thing

Collapse
 
ufko profile image
ufko

Yes, that is what call by sharing is 👍 When I google "is javascript pass by value" I see results which says "javascript is pass by value". Only a few of them mentions the term call by sharing. So I'm just interested in the terminology here.

Collapse
 
mebble profile image
Neil Syiemlieh

Yeah I had forgotten what call by sharing was until I read your post. I'd gotten used to calling it "call by reference"! I think Python uses the same model if I'm not wrong. Anyway, welcome to DEV!

Thread Thread
 
ufko profile image
ufko

Thanks! 😄