Home > Article > Web Front-end > Write js extension method to determine whether an array contains an element_javascript skills
In C# syntax, you can use the Contains method to determine whether a collection contains an element, but how to deal with similar problems in JavaScript? There is no Contains method in js.
We can use the prototype extension of js to encapsulate our own Contains method.
js code: