0% found this document useful (0 votes)
10 views1 page

JavaScript Timers and Promises Tasks

The document outlines JavaScript tasks involving setTimeout, setInterval, and Promises. It includes five tasks for each category: displaying messages, showing advertisements, updating time, playing sounds, and creating countdowns for setTimeout and setInterval; and for Promises, it covers login verification, order status, OTP verification, and age validation. Each task specifies the expected functionality and conditions for resolution or rejection.

Uploaded by

TC Mathan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

JavaScript Timers and Promises Tasks

The document outlines JavaScript tasks involving setTimeout, setInterval, and Promises. It includes five tasks for each category: displaying messages, showing advertisements, updating time, playing sounds, and creating countdowns for setTimeout and setInterval; and for Promises, it covers login verification, order status, OTP verification, and age validation. Each task specifies the expected functionality and conditions for resolution or rejection.

Uploaded by

TC Mathan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

JavaScript Tasks: setTimeout, setInterval, and

Promises

Part 1: setTimeout and setInterval Tasks


1 Warning Message: When a user clicks a button, use setTimeout() to display a warning
message after 5 seconds.
2 Advertisement Delay: When a website opens, use setTimeout() to show an advertisement after
10 seconds.
3 Live Clock: Use setInterval() to update and display the current time every 1 second on a
webpage.
4 Notification Sound: Use setInterval() to play a notification sound every 10 minutes (600000
milliseconds).
5 Countdown Timer: Use setInterval() to decrease a counter every second until it reaches zero,
then stop the timer.

Part 2: JavaScript Promise Tasks


1 Task 1: Login Verification
Create a Promise that checks username and password. Resolve if valid, reject if invalid.
2 Task 2: Online Order Status
Create a Promise that checks item stock. Resolve with 'Order confirmed' if available, reject with
'Out of stock' if not.
3 Task 3: OTP Verification
Create a Promise that sends an OTP. Resolve if OTP is correct, reject if incorrect or expired.
4 Task 4: Age Validation
Create a Promise that checks user age. Resolve if age is 18 or above, reject if below 18.

You might also like