All it is, is a simple function that takes two variables and "merges" (concats) them. Code below:
function merge(var1, var2) {
var1 += var2;
}
var a = 'a';
var b = 'b';
merge(a, b);
console.log(a);
When I call a console log inside the function, it works as planned, and prints 'ab', however on the outside of the function if I console log a, the expected result is of course 'ab' but it prints 'a'. I understand this is because a function is an asynchronous event therefore it is run after the console log outside is run however I haven't the slightest clue how to go around this. All help is appreciated.