function removeWhitespaces(string, i = 0, res = "") {
if (i >= string.length)
return res
else
if (string[i] == " ")
return removeWhitespaces(string, i + 1, res)
else
return removeWhitespaces(string, i + 1, res += string[i])
}
console.log(removeWhitespaces(" Hello World, how is it going ? "))