Home  >  Article  >  Web Front-end  >  javascript自定义in_array()函数实现方法_javascript技巧

javascript自定义in_array()函数实现方法_javascript技巧

WBOY
WBOYOriginal
2016-05-16 15:47:411211browse

本文实例讲述了javascript自定义in_array()函数实现方法。分享给大家供大家参考。具体如下:

function in_array( what, where ){
  var a=false;
  for(var i=0;i<where.length;i++){
   if(what == where[i]){
   a=true;
  break;
   }
  }
  return a;
}

希望本文所述对大家的javascript程序设计有所帮助。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn