Guest User

Untitled

a guest
Oct 20th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. /**
  2. * Viết hàm countDown đếm ngược từ x về 0, mỗi lần đếm cách nhau 1s, sau đó hiển thị 'Happy new year'
  3. */
  4. function countDown(x) {
  5. var countDowntID = setInterval(function(){
  6. --x;
  7. console.log(x);
  8. if(x === 0){
  9. clearInterval(countDowntID);
  10. console.log('Happy new year');
  11. }
  12. },1000);
  13.  
  14. }
  15.  
  16. countDown(5);
Add Comment
Please, Sign In to add comment