Как использовать для JavaScript
const array1 = ['a', 'b', 'c'];
for (const element of array1) {
console.log(element);
}
Dark Dunlin
const array1 = ['a', 'b', 'c'];
for (const element of array1) {
console.log(element);
}
const numbers = [1,2,3,4];
for(const item of numbers){
console.log(item);
}
const array = [1,2,3,4,5];const evenNumbers = array.filter(function(elem) { // expressions that return 'true' are retained return elem % 2 == 0;});
let items = ["a", "b", "c", "d"];
for(item of items)
{
console.log(item);
/*yields a b c d*/
}
(function() {
for (const argument of arguments) {
console.log(argument);
}
})(1, 2, 3);
// 1
// 2
// 3