function split(str) { if(!str.length) { return ""; } return str[0] + split(str.slice(1)); } //Exercise 5 - String Splitter function split(str) { if(!str.length) { return; } return str[0] + "-" + split(str.slice(1)); } console.log(split("hello")) //Binary function binary(num) { if (num < 2){ return num; } else { return binary(Math.floor(num/2)).toString() + (num % 2).toString(); } } binary(37); //Factorial var factorial = x => { if (x === 0) { return 1; } return x * factorial(x-1); } console.log(factorial(3)) //Fibonacci vvar fibonacci = x => { if (x <= 1) { return 1 } return fibonacci(x - 1) + fibonacci(x - 2); } for (i=0; i<20; i++){ console.log(fibonacci(i)); }