Phương thức setTimeout() đặt bộ hẹn giờ thực thi một chức năng hoặc đoạn mã nào đó sau khi thời gian đặt trước đã trôi qua.
setTimeout(code)
setTimeout(code, delay)
setTimeout(functionRef)
setTimeout(functionRef, delay)
setTimeout(functionRef, delay, param1)
setTimeout(functionRef, delay, param1, param2)
setTimeout(functionRef, delay, param1, param2, /* … ,*/ paramN)
Phương thức đơn giản này chỉ có chút rắc rối khi dùng từ khóa this
.