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


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


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)}


Thank you so much


Thank you SAN !!