1let panier = ['fraise', 'banane', 'poire'];
2
3for (const fruit of panier) {
4 // console.log(fruit);
5 console.log(panier.indexOf(fruit));
6}
1const array1 = ['a', 'b', 'c'];
2
3for (const element of array1) {
4 console.log(element);
5}
6
7// expected output: "a"
8// expected output: "b"
9// expected output: "c"
10
1const array1 = ['a', 'b', 'c'];
2
3for (const element of array1) {
4 console.log(element);
5}
1(function() {
2 for (const argument of arguments) {
3 console.log(argument);
4 }
5})(1, 2, 3);
6
7// 1
8// 2
9// 3
1const array = [1,2,3,4,5];const evenNumbers = array.filter(function(elem) { // expressions that return 'true' are retained return elem % 2 == 0;});