How to pass a primitive variable (like a string) by reference when calling a java script method? Which is equivalent of out or ref keyword in C#.
I have a variable like var str = "this is a string"; and passing the str into my function and automatically have to reflect the change in str when i change the argument value
function myFunction(arg){
    // automatically have to reflect the change in str when i change the arg value
    arg = "This is new string";
    // Expected value of str is "This is new string"
}
 
    