As an example, we are going to add 15 seconds to a date in the below example.
Here we have used Date object and two methods: setSeconds() and getSeconds()
The output of this Script:
Wed Oct 24 2018 02:20:30 GMT+0530 (India Standard Time)
I have added 15 seconds with this below line:
getSeconds() method will fetch the seconds from the Date object. Next, I have used +15 to add an extra 15 seconds to it.
I hope this tutorial is useful to you. Feel free to comment in the below comment section. Happy coding