Factorial in JavaScript - recursive

<<algorithm

fact rec en

<!DOCTYPE html>
<html>
<body>
<script>
function factorial(n) {
  if (n > 1)
    return n * factorial(n-1);
  else
    return 1;
}
var n = prompt("n:", "");
alert(n + "! = " + factorial(n));
</script> 
</body>
</html>