samedi 3 octobre 2020

Does somebody know how to use and IF, Else statement with an array?

So, i need to do an if statemente with an input value and compare it with an array list

here is my code:

var cib = document.getElementById("cibernetico").value;
var ciber = ('ciber','bin');

function validar() {

if (cib == ciber)
{
 alert("Gotta !!");
 
} else {

 alert("wrong"); } 
 
 }
<body>



 <input id="cibernetico" type="text"  placeholder="ci...">
<input type="submit" value="Submeter" class="button" onclick="validar()">


</body>

Aucun commentaire:

Enregistrer un commentaire