I put this function in firebug and it returns the value 24. I just need help of someone explaning me as simple but descriptive as possible how the code works.
i was just reading a book and these were just one of the examples of functions which I was trying to understand better.
Code:
function factorial(n) { var product= 1; while(n > 1) {product *= n; n--; } return product; } factorial(4)
Comment