Home > Web Front-end > JS Tutorial > Angularjs array determines the instance code of an element

Angularjs array determines the instance code of an element

小云云
Release: 2018-03-01 09:51:46
Original
1477 people have browsed it

This article mainly shares with you an example of how to determine whether an angularjs array contains an element, that is, the in_array function, which determines whether an array contains an element.

  Array.prototype.in_array = function(e)
  {
    for(i=0;i<this.length;i++)
    {
      if(this[i] == e)
        return true;
    }
    return false;
  }
Copy after login

Usage:

tmp.in_array(id)
Copy after login

Related recommendations:

php determines whether the element appears in the array

jQuery Method to determine whether an element is hidden

JS implementation code to determine whether an element is in an array_javascript skills

The above is the detailed content of Angularjs array determines the instance code of an element. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template