---
description: >-
  https://www.youtube.com/watch?v=G2fo9dQ1DPM&list=PLmSai9ZRK6uyZ7L8k10pOSvQRhZbg1W4w&index=2
---

# \[JavaScript chuyên sâu] - Higher order function - phần 2: closure, currying, callback

```
function taikhoan(tiencuatoi) {
    let myMoney = tiencuatoi;
    return {
        xem: function() {
            return `Bạn có ${myMoney} trong tài khoản 👍`
        },
        nap: function(amount) {
            myMoney = myMoney + amount;
        },
        rut: function(amount) {
            if(amount > myMoney) {
                retun "Hết tiền";
            }
            myMoney = myMoney - amount;
        }
    }
}
```
