Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. /**
  2. * Tạo 1 hàm doAfter nhận vào 2 tham số:
  3. * - Tham số thứ 1: 1 function
  4. * - Tham số thứ 2: Thời gian x (ms)
  5. * Hàm này sẽ gọi function sau 1 khoảng thời gian x ms
  6. */
  7.  
  8. var readlineSync = require('readline-sync');
  9. console.log('Waiting....');
  10. function doAfter (fn,ms){
  11. var timeS = setTimeout(fn,ms);
  12. return timeS;
  13. };
  14. function fn(){
  15. console.log('Hello,Nice to meet you!');
  16. };
  17. var timeS= readlineSync.question('Set Time: ');
  18. doAfter(fn,timeS);
  19. console.log('Thank you!');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement