Task: Printing a Sequence
Task
Swipe to start coding
Write a JavaScript program which prints the first ten even numbers.
- Create a new
for
loop with the following parameters:- Initialization: Value of
i
initialized to1
. - Condition:
i <= 10
used as the loop condition. - Operation: Value of
i
incremented after every iteration.
- Initialization: Value of
- Use a
console.log
to output the value ofi
multiplied with2
in every iteration. This will give the corresponding even number.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 6. ChapterΒ 2
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 1.33
Task: Printing a Sequence
Swipe to show menu
Task
Swipe to start coding
Write a JavaScript program which prints the first ten even numbers.
- Create a new
for
loop with the following parameters:- Initialization: Value of
i
initialized to1
. - Condition:
i <= 10
used as the loop condition. - Operation: Value of
i
incremented after every iteration.
- Initialization: Value of
- Use a
console.log
to output the value ofi
multiplied with2
in every iteration. This will give the corresponding even number.
Solution
Everything was clear?
Thanks for your feedback!
Awesome!
Completion rate improved to 1.33SectionΒ 6. ChapterΒ 2
single