I am new to coding. I would like to add more variables to my current code. Right now if you type in "dog" it will open youtube. How would you add another variable so that if you typed dog it would still open youtube but if you typed "cat" it would open Netflix for example? How do you do this? thank you to any and all who help. just remember I am still new to coding so please do not criticize.
const myFunction = () => {
if (document.getElementById('textInput').value === 'dog'){
window.open(
"https://youtube.com", "_blank");
}
}
<input type="text" id="textInput" oninput="myFunction()">
Aucun commentaire:
Enregistrer un commentaire