10 examples of 'jquery array each' in JavaScript

Every line of 'jquery array each' 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
this disclaimer
91export function each<A>(array: ArrayLike<A>, fn: (value: A, index: number) => void): void {
92 const length = array.length;
93
94 for (let i = 0; i < length; ++i) {
95 fn(array[i], i);
96 }
97}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

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}
177function each($,sNames,fnCallback) {
178 jQuery.each(sNames.split("/"), function(i,n) {
179 $ = $.children(n);
180 });
181 jQuery.each(function(i,e) {
182 fnCallback(jQuery(e));
183 });
184}
66function each(arr, callback) {
67 var length = arr.length;
68 var i;
69
70 for (i = 0; i < length; i++) {
71 callback.call(arr, arr[i], i, arr);
72 }
73
74 return arr;
75}
2export default function arrayEach(array: Array<any>, iterator: Function): void {
3 for (let i = 0, len = array.length; i < len; ++i) {
4 iterator(array[i], i)
5 }
6}
2export function each (array, iterator) {
3 const len = array.length
4
5 for (let i = 0; i < len; i++) {
6 iterator(array[i], i, len)
7 }
8}
3287function arrayEach(array, iteratee) {
3288 var index = -1,
3289 length = array == null ? 0 : array.length;
3290
3291 while (++index < length) {
3292 if (iteratee(array[index], index, array) === false) {
3293 break;
3294 }
3295 }
3296 return array;
3297}
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}
10function each<T, U extends ArrayLike<T> = ArrayLike<T>> ( arr: U, callback: EachCallback<U[0]>, reverse?: boolean ): U {
11
12 if ( reverse ) {
13
14 let i = arr.length;
15
16 while ( i-- ) {
17
18 if ( callback.call ( arr[i], i, arr[i] ) === false ) return arr;
19
20 }
21
22 } else {
23
24 for ( let i = 0, l = arr.length; i < l; i++ ) {
25
26 if ( callback.call ( arr[i], i, arr[i] ) === false ) return arr;
27
28 }
29
30 }
31
32 return arr;
33
34}
243function each(arr, fn) {
244 var l = arr ? arr.length : 0;
245 var i = -1;
246 while (++i < l) fn(arr[i], i);
247}

Related snippets