Codewars 8 Kyu problem

·

1 min read

Today's problem was: Simple, remove the spaces from the string, then return the resultant string.

I remember doing this a long time ago but I completely forgot. I looked at the answer but instead of copying and pasting, I looked up what each line of code did. Here is the code:

function noSpace(x){ //noSpace is the name of the function.

return x.split(' ') I'm splitting whatever is inside the parenthesis. The .split function puts the string into an array.

.join(''); // .join method converts the array into a string.

Remember, if you don't know the answer, it's okay to look up the answer. However, don't just copy and paste. Study each line of code so you will have a better understanding of the code.