var summation = function(num) {
if (num <= 0) {
console.log("number should be greater than 0");
} else {
return (num + summation(num - 1));
}
};
console.log(summation(5));
it gives me NaN error but i want summation of number.where am i making mistake?