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