MichaelMelin MichaelMelin - 1 year ago 44
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 Source
var input = prompt();

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