Q:

Write a JavaScript program to redirect to a specified URL

0

 Write a JavaScript program to redirect to a specified URL.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

const redirect = (url, asLink = true) =>
  asLink ? (window.location.href = url) : window.location.replace(url);
redirect('https://google.com');

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now