I have the following code but it is not giving perfect result for factorial can u find it out plz
The important part of the function is this line:
x = x * fact(x-1);
but the fact function does not return a value, so this is the same as x * undefined. Try adding return x; to the bottom of your function.
fact
x * undefined
return x;