📅  最后修改于: 2022-03-11 15:02:12.081000             🧑  作者: Mango
function factorial(n) {
let s = new Stack();
while (n>1){
s.push(n--);
}
let product = 1;
while (s.length() > 0) {
product *= s.pop();
}
return product;
}