How can JavaScript be used to refresh a page only when a button is clicked, instead of at regular intervals?

To refresh a page only when a button is clicked in JavaScript, you can create an event listener for the button click event. When the button is clicked, you can use the location.reload() method to refresh the page. This way, the page will only refresh when the button is clicked, rather than at regular intervals. ```html <!DOCTYPE html> <html> <head> <title>Refresh Page on Button Click</title> </head> <body> <button id="refreshButton">Refresh Page</button> <script> document.getElementById('refreshButton').addEventListener('click', function() { location.reload(); }); </script> </body> </html> ```