1

When reading through the ECMAScript specification, I noticed, it actually never mentions concepts like "pass by value" or "pass by reference".

When looking at the assignment operator, this is how it is specified:

An expression like

let a = 4

would lead to path 1.d. Which basically just sets the value of 4 to a. But same would be true for the assignment of an object.

Does this mean, it would be a conforming ECMAScript implementation to copy objects by value (which obviously isn't the case in any known implementation)?

I have checked Emacs documentation but I did not get a satisfying solution, I want an experienced JavaScrip

amalloy
  • 89,153
  • 8
  • 140
  • 205
Caleb
  • 25
  • 4
  • 1
    It's the other way around. The specification never says copies are made, so assignments are always references to the same object. See the specification of [`GetValue()`](https://tc39.es/ecma262/#sec-getvalue) – Barmar May 03 '23 at 16:03
  • Also see: https://stackoverflow.com/questions/23554770/how-to-explain-object-references-in-ecmascript-terms – Thomas Frank May 03 '23 at 16:04

0 Answers0