[JavaScript chuyên sâu] Higher order function trong JavaScript - phần 1 (ok)
https://www.youtube.com/watch?v=1harjGo3KWg&list=PLmSai9ZRK6uyZ7L8k10pOSvQRhZbg1W4w&index=1

Chú ý: Nếu return function nó sẽ chạy tiếp function cái khác thì đều rừng lại
function cha() {
let x = 10;
return function con(p) {
x++;
return x + p;
}
}
const test = cha();
console.log(test(1)); // 12
console.log(test(1)); // 13
Previous=== START JavaScript chuyên sâu ===Next[JavaScript chuyên sâu] - Higher order function - phần 2: closure, currying, callback
Last updated
Was this helpful?