Write an event driven program in JavaScript which display the even numbers between 11 to 30
Answers
Answered by
0
Explanation:
function* range(begin, end, filter, ite = 1) {
for (var x = begin; x != end; x += ite) {
if (filter(x)) {
yield x;
}
}
}
function is_even(i) { return i % 2 == 0; }
window.onload = function() {
for (var i of range(1,50,(i) => is_even(i))) {
console.log(x);
}
}
The output of the above written program will be something of this manner
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50
Similar questions
Biology,
4 months ago
Science,
4 months ago
Computer Science,
4 months ago
Math,
9 months ago
Math,
9 months ago