Actually, there are two spaces in the given example output as well.
Additionally, you could also use,
function spacify(str) {
return str.split('').join(' ').replace(' ','');
}
to remove the additional space.