JavaScript program to find the sum of natural numbers using recursion:
function sumOfNaturalNumbers(number) {
if (number === 1) {
return 1;
} else {
return number + sumOfNaturalNumbers(number - 1);
}
}
let number = parseInt(prompt("Enter a number:"));
console.log("The sum of natural numbers upto " + number + " is: " + sumOfNaturalNumbers(number));