[] im putting this here for everyone to
[] im putting this here for everyone to use.

A:

I think you should use a function that returns a string.
function getString(string) {
    return string.replace(/[^\s]+/g, '');
}

function getString(string) {
    return string.replace(/[^\s]+/g, '');
}

function getString(string) {
    return string.replace(/[^\s