Course Content
Introduction to JavaScript
Introduction to JavaScript
3. Performing Operations in JavaScript
Understanding Assignment OperatorsMathematical Operations in JavaScriptAssignment Operators in JavaScriptIncrement and Decrement OperatorsChallenge: Variable Operations PracticeComparison Operators in JavaScriptLogical Operators ExplainedChallenge: Compare Variables in JavaScriptConcatenating Strings in JavaScriptChallenge: Build Sentences with JavaScript
4. Controlling Program Flow with Conditional Statements
5. Looping Through Data in JavaScript
Challenge: Print Numbers from 5 to 9
Task
Let's implement a while loop that outputs numbers from 5 to 9 to the console.
let a = 5; ___ (a ___ ___) { console.log(___); ___++; };
The output should be:
python
- Set the condition toΒ a
<= 9
Β orΒa < 10
. - Include the variableΒ
a
Β within theΒconsole.log()
Β function. - Increment the value ofΒ
a
Β inside the loop.
let a = 5; while (a <= 9) { console.log(a); a++; }
Everything was clear?
Thanks for your feedback!
SectionΒ 5. ChapterΒ 3