MichaelMelin MichaelMelin - 7 months ago 10
Javascript Question

How to use user's input on a prompt to search something up on wiki

I am trying to make it so the user input is searched on wiki or whatever site.

var input = prompt();

if(input === "") {
window.location.href = ("https://en.wikipedia.org/wiki/Steve_Jobs");
};


Thoughts?

Answer
var input = prompt();

if (input !== "") {
    window.location.href = ("https://en.wikipedia.org/wiki/" + input);
}
Comments