I try to understand a conceptual difference between:
var x = '8aaaaa dddd r '
function noSpace(x){
return (x.split(" ").join(""));
}
noSpace(x) //Results in "8aaaaaddddr"
AND
var x = '8aaaaa dddd r '
function noSpace(x){
x.split(" ").join("");
return x;
}
noSpace(x) //Results in "8aaaaa dddd r "
Why does the second version don't work as the first one?