I want to swap As with Bs and vice versa which appear multiple times in a string.
function temp(a,b) {
console.log('The first is ' + b + ' and the second is ' + a + ' and by the way the first one is ' + b);
}
temp('a','b')
eval(temp.toString().replace('first','second'));
eval(temp.toString().replace('second','first'));
temp('a','b');
This does not work but I would like to get the following outcome:
The first is a and the second is b and by the way the first one is a
temp('b', 'a')?