Answer:
const SIZE=8
function print(n, s) {
if (n > 0) {
process.stdout.write(s);
print(n-1, s);
}
}
function main(n=1) {
if (n<=SIZE) {
print(SIZE-n, " ");
print(n, "* ");
process.stdout.write("\\");
main(n+1);
}
}
main();
Step-by-step explanation:
Here is a solution in javascript. Note that it uses recursion multiple times to avoid loops.