Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Task: Printing a Sequence | Discovering Loops
Introduction to JavaScript

Swipe to show menu

book
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 to 1.
    • Condition: i <= 10 used as the loop condition.
    • Operation: Value of i incremented after every iteration.
  • Use a console.log to output the value of i multiplied with 2 in every iteration. This will give the corresponding even number.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 6. ChapterΒ 2
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

close

Awesome!

Completion rate improved to 1.33

book
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 to 1.
    • Condition: i <= 10 used as the loop condition.
    • Operation: Value of i incremented after every iteration.
  • Use a console.log to output the value of i multiplied with 2 in every iteration. This will give the corresponding even number.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

close

Awesome!

Completion rate improved to 1.33

Swipe to show menu

some-alt