»
EnglishFrenchVietnamese

Print - in_array() - JavaScriptBank.com

Full version: jsB@nk » Snippet » in_array()
URL: https://www.javascriptbank.com/in-array.html

in_array() © JavaScriptBank.comThis snippet searches an array for a pre-specified element and returns 'true' if it's found, 'false' if it's not found. It functions like the in_array() in PHP.

Full version: jsB@nk » Snippet » in_array()
URL: https://www.javascriptbank.com/in-array.html



JavaScript
<script type="text/javascript">// Benoit Asselin - http://www.ab-d.frArray.prototype.in_array = function(p_val) {for(var i = 0, l = this.length; i < l; i++) {if(this[i] == p_val) {return true;}}return false;}</script>