What will be the output of the following recursive function?
function removeDuplicates(str) {
if (str.length <= 1) {
return str;
}
let firstChar = str.charAt(0);
let remainingStr = str.substr(1);
if (remainingStr.includes(firstChar)) {
return removeDuplicates(remainingStr);
}
return firstChar + removeDuplicates(remainingStr);
}
console.log(removeDuplicates("Hello World"));