一、函数声明提升
sayHi();
function sayHi() {
console.log('hi');
}
二、递归
var factorial = (function f(num) {
if (num <= 1) {
return 1;
} else {
return num * f(num - 1);
}
});
console.log(factorial(4));
网友评论