Hello there everyone,
I’ve been trying to figure out how to create a function that takes any input and adds spaces to it before returning it. For example. The function would change “hello” into “h e l l o”
When I perform the task -not- as a function, it seems to work okay. I previously had some good feedback about using the split() and join() functions and that seems to get the desired effect.
It just doesn’t seem to be working as a function. Here is the code that I have come up with so far:
function sStr(aString)
{
var mySplitResult = aString.split("").join(" ");
return mySplitResult;
}
window.alert(sStr(test));
I would really appreciate any help with this as I’m racking my brains trying to learn this stuff. I can see that I still have a long way to go.
Put quotes around
testlike :