this question has answer here:
- best way find if item in javascript array? [duplicate] 8 answers
- check if object array? 36 answers
i learning javascript , came across problem. want catch input value using document.formname.elementname.valueand compare value instance of array object.if value exists throw alert!.
you can use indexof() function : array.indexof("string") return -1 if item not found, otherwise position. here's link w3schools.
Comments
Post a Comment