xxxxxxxxxx
Ligne 427 : if(model.Code_Structure != null)
Ligne 428 : {
Ligne 429 : foreach (var group in liste_poste.Where(x => x.code.StartsWith(model.Code_Unite)
Ligne 430 : && x.code.Length <= 19 && x.code.Length >= 15))
Ligne 431 : {
xxxxxxxxxx
let words = ['one', 'two', 'three', 'four'];
words.forEach((word) => {
console.log(word);
});
// one
// two
// three
// four
xxxxxxxxxx
var items = ["item1", "item2", "item3"]
var copie = [];
items.forEach(function(item){
copie.push(item);
});
xxxxxxxxxx
var stringArray = ["first", "second"];
myArray.forEach((string, index) => {
var msg = "The string: " + string + " is in index of " + index;
console.log(msg);
// Output:
// The string: first is in index of 0
// The string: second is in index of 1
});
xxxxxxxxxx
var array = ["a","b","c"];
// example 1
for(var value of array){
console.log(value);
value += 1;
}
// example 2
array.forEach((item, index)=>{
console.log(index, item)
})
xxxxxxxxxx
const array1 = ['a', 'b', 'c'];
array1.forEach(element => console.log(element));
xxxxxxxxxx
const avengers = ['thor', 'captain america', 'hulk'];
avengers.forEach((item, index)=>{
console.log(index, item)
})
// logs: 0 'thor', 1 'captain america', 2 'hulk'
xxxxxxxxxx
let colors = ['red', 'blue', 'green'];
// idx and sourceArr optional; sourceArr == colors
colors.forEach(function(color, idx, sourceArr) {
console.log(color, idx, sourceArr)
});
// Output:
// red 0 ['red', 'blue', 'green']
// blue 1 ['red', 'blue', 'green']
// green 2 ['red', 'blue', 'green']
xxxxxxxxxx
const arraySparse = [1,3,,7]
let numCallbackRuns = 0
arraySparse.forEach((element) => {
console.log(element)
numCallbackRuns++
})
console.log("numCallbackRuns: ", numCallbackRuns)
// 1
// 3
// 7
// numCallbackRuns: 3
// comment: as you can see the missing value between 3 and 7 didn't invoke callback function.
xxxxxxxxxx
const arr = ["some", "random", "words"]
arr.forEach((word) => { // takes callback and returns undefined
console.log(word)
})
/* will print:
some
random
words */
xxxxxxxxxx
const dogs = [
'Husky','Black Lab',
'Australian Shepard',
'Golden Retriever',
'Syberian Husky',
'German Shepard'
]
dogs.forEach(function(dog) {
console.log(dog);
});