This is really just for fun, and my own education.
Let's say that I have this:
str = func(str);
function func(oldStr) {
// do stuff
return newStr;
}
Is there a way to modify func() so that, if
oldStr is not explicitly defined, it would use the value of
str (the left operand of the assignment)?
I know that I could do this, of course:
function func(oldStr = str) but in production I wouldn't know the name of the variable that was assigned. So I'm trying to figure out if there's a built-in variable that equals the value of the left hand operator.
The end goal is to be able to use
str = func(); without typing
str twice :-)