The substring method The substring method is used to get the substring of a given string by specifying the start and end numbers. The starting index is the number of character in the given string that will be included to get the The starting index is the number of character in the given string that will be included to
The prompt dialog type The prompt dialog is the way to ask a user for some input value in the form of a dialog box. A User is given the Ok and Cancel options to proceed after entering text. If Ok is pressed it will return entered value. If Cancel is pressed, the null is returned. See a prompt
In previous chapter we learnt how to use setTimeout method to execute a given function/code once with given time delay. If you need to execute a function or code repeatedly with given time delay then use setInterval method.
The setInterval method keeps on executing given function or code by given time delay until window is closed or you can use clearInterval method to stop it.
The setTimeout method is used to “delay” in executing a given function by specifying time in milliseconds. This is quite useful in situations like redirecting to another website while notifying a user “you will be redirected to another site in 10 seconds” etc.
The setTimeout method takes two required parameters as shown in syntax below:
The href is a property of window.location object that is used to get the complete URL of existing web page. You can also use window.location.href to set the URL of current page.
You can simply use location.href as well instead window.location.href.