samedi 20 février 2016

check if a string is part of an array - javascript [duplicate]

This question already has an answer here:

I want to be able to see if "megan" is a part of the array people. Though, i can only do this by using people[2].

Here is my code:
var people = new Array("jack","ian");
document.write(people[0]);
people.push("megan");
document.write("<br />");




Aucun commentaire:

Enregistrer un commentaire