Factorial in JavaScript - iteratively

 <<algorithm

Factorial iteratively

<!DOCTYPE html>
<html>
<body>
<script>
var n = prompt("n:", "");
var i = 1;
var s = 1;
while (i <= n) s *= i++;
alert(n + '! = ' + s);
</script> 
</body>
</html>