Please can someone confirm the following assertions about the code below?
- the contents (i.e. the string it is pointing to) of
str
will not be copied when it is passed as an argument intof
- that parameter
p
, created in the execution context instantiated for the call tof
is a value which is a reference to the memory containing the interned value "foo" (hence no copy occurred) that
String#slice
does not copyp
var str = 'foo'; function f(p) { return p.slice(2); // creates a new string with "o" as the contents } f(str);