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

Svep för att visa menyn

book
Task: Printing a Sequence

Uppgift

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.

Lösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 6. Kapitel 2
Vi beklagar att något gick fel. Vad hände?

Fråga AI

expand
ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

book
Task: Printing a Sequence

Uppgift

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.

Lösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 6. Kapitel 2
Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Vi beklagar att något gick fel. Vad hände?
some-alt