10 examples of 'each array jquery' in JavaScript

Every line of 'each array 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
this disclaimer
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}
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

6function each(els, callback) {return Array.prototype.forEach.call(els, callback);}
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}
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}
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}
3root.define("utilities.each", function each(array, callback)
4{
5 if (Array.isArray(array)) for(var arrayCounter=0;arrayCounter<array.length;arrayCounter++) callback(array[arrayCounter], arrayCounter);
6 else if (array !== undefined)
7 {
8 var keys = Object.keys(array);
9 for(var keyCounter=0;keyCounter<keys.length;keyCounter++)
10 {
11 var key = keys[keyCounter];
12 callback(array[key], key);
13 }
14 }
15});
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}
24function each(arrayLike, fun) {
25 for (var i = 0, len = arrayLike.length; i < len; i++) {
26 fun(arrayLike[i], i)
27 }
28}
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}
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