Javascript: inArray |
Written by Administrator | |
luned́, 25 agosto 2008 | |
Here below a simple example to build a inArray Javascript method
simil to PHP function.
Array.prototype.inArray = function (value) {
The method searches for an identical value, rather than a similar one. If you want just a similar value (the string "003" should match for example with the integer 3), this could be changed by replacing "===" with "==" in line 4.
if (MyArray.inArray('value')) { |
|
Last Updated ( luned́, 25 agosto 2008 ) |