Jump to content

Find In Array


subha rr
 Share

Recommended Posts

var data = new Array(value1, value2, ...... );var value = "myvalue";var num = 0;for(var i = 0; i < data.length; i ++){   if ( data[i] == value ) {	   num++;   }}if  ( num > 0  ) { 	alert("the value " + value + " has occurred " + num + " times");	} else { 		   alert("the value " + value + " was not found");		   }

Edited by Shade
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...