View Full Version : Javascript Version of PHP in_array()

27 Feb 2003, 00:38
Title says it all...

I love the PHP in_array() and use it quite a bit. But in order to get my my code to display in a template, I need to get that same functionality in JavaScript, but I don't think such a function exists...

Esentially, I'm generating a table with numbers in it. If the cell number is in an array, it changes the background of the table. Works great it PHP, but I have no idea how to do it in JavaScript.

Any ideas?

27 Feb 2003, 22:57

I didn't find it... what I ended up doing is a bunch of OR statements, which is really messy, but end users wont' be looking at the code...