【js】——如何判断一个字符是否在某个字符数组中



var arr = [ "xml", "html", "css", "js" ];  
  1. $.inArray("js", arr);  //返回 3,
  2. 如果不包含在数组中,则返回 -1;

你可能感兴趣的:(js)