I'm a bit confused about passing the JavaScript variables by reference.
Take the following piece of code:
var p = [1,2];
var pRef = p;
p.push(3);
pRef === p; // true
Then consider the following piece of code:
var s = "ab";
var sRef = s;
s = s + "c";
sRef === s; // false
what is the trick about passing the JavaScript variables by reference?
Does it exist a way to create a reference to a string?