The for loop 2 | Sololearn: Learn to code for FREE!

0

The for loop 2

How to proceed? Task Complete the code to output the given expression 3 times. Sample Input Learning is fun! Sample Output Learning is fun! Learning is fun! Learning is fun! var expression = readLine(); //your code goes here for (; expression <= 3; expression++) {document.write(expression + "<br/>");}

9/11/2021 4:55:49 AM

Nizwm Borgoyari

3 Answers

New Answer

+5

The for loop has the following syntax: for (statement 1; statement 2; statement 3) {   // code block to be executed } Statement 1 is executed (one time) before the execution of the code block. Statement 2 defines the condition for executing the code block. Statement 3 is executed (every time) after the code block has been executed. Solution: for(var i=0;i<3;i++){console.log(expression)}

+1

Thank you so much

+1

Thank you SAN !!