Course Content
Introduction to JavaScript
Introduction to JavaScript
Challenge: Tigers
Task
Implement a for
loop that outputs the word "Tiger" exactly 5 times.
let tiger = "___"; ___ (let ___ = 0; i < ___; ___) { console.log(___); };
The output should be:
- Begin by assigning the value "Tiger" to the variable
tiger
. - Utilize the
for
keyword to create the loop. - Initialize the counter variable
i
. - Set the range for the counter
i
to go from0
to4
(5 loop iterations: 0, 1, 2, 3, 4). - Include the increment operation (
++
) for thei
counter. - Place the
tiger
variable inside theconsole.log()
function.
let tiger = "Tiger"; for (let i = 0; i < 5; i++) { console.log(tiger); };
Everything was clear?