10 examples of 'foreach class jquery' in JavaScript

Every line of 'foreach class jquery' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
6function each(els, callback) {return Array.prototype.forEach.call(els, callback);}
6function forEach(arr, callback, thisObj) {
7 if (arr == null) {
8 return;
9 }
10 var i = -1,
11 n = arr.length;
12 while (++i < n) {
13 // we iterate over sparse items since there is no way to make it
14 // work properly on IE 7-8. see #64
15 if ( callback.call(thisObj, arr[i], i, arr) === false ) {
16 break;
17 }
18 }
19}
90function _each(fnName, className) {
91 _each2.each(this, function (element) {
92 element.classList[fnName](className);
93 });
94}
389function forEach (array, callback, thisObj)
390{
391 for (var i=0; i
35function foreach(arr, fn) {
36 if (!arr) return;
37
38 if (arr instanceof Array) {
39 for (var i=0; i
79function forEach(array, callback, scope) {
80 for (var i = 0; i < array.length; i++) {
81 callback.call(scope, i, array[i]); // passes back stuff we need
82 }
83}
30function each(array, fn) {
31 if (typeof array.forEach === "function") return array.forEach(fn);
32
33 for (var i = 0; i < array.length; i++) fn(array[i], i);
34}
110function forEach(elements, callback) {
111 Array.prototype.forEach.call(elements, callback);
112}
8function $$each(selector, func) { [].forEach.call($$(selector), func) }
102function each (arr, fn) {
103 if (Array.prototype.forEach) {
104 arr.forEach(fn)
105 } else {
106 let i = 0,
107 len = arr.length
108 for (; i < len; i++) {
109 fn(arr[i], i)
110 }
111 }
112}

Related snippets