Hi, I’m trying to use the return statement to return a value but nothing shows in the console when i try?
I am currently using JS. Please find code below.
function findFactorialRecursive(number) {
//code here
if(number === 2){
return 2;
}
console.log(number);
return number * findFactorialRecursive(number-1);
}
console.log doesn’t log to the replit console, rather the browser’s console. I recommend opening your website in a new tab and using developer tools (usually CTRL+SHIFT+I; or right click and you should see it). Let me know if this helps!
Thanks for the help, the method you say works however I would like to know if it is possible to have the method ‘’‘return number * findFactorialRecursive(number-1);’‘’ work on the replit site without having the need to open developer tools.
With the code you showed me, everything works as intended. Without developer tools you won’t be able to see what console.log says, but the function should still return the value. What is not working? Are you using that returned value?
I can see the console.log without using developer tools. The issue i’m having is with the Return statement. It returns no value and the console looks like this. This is what shows after I have hit run