What are the conditions for ending the cycle?

for(var i=0,k=0;i<1,k<3;iPP,kPP){
    console.log(i)
    console.log(k)
}
Feb.23,2022

this is a comma expression, and the value of the expression is determined by the expression after the last comma. (expression 1, expression 2, expression 3,., expression n) = expression n , so the loop condition is k < 3 , regardless of I .


the end judgment statement is I < 1 and k < 3 , so the ending condition is iMag3

.

clipboard.png

= correct =

tried, and the final judgment sentence is indeed k < 3 as @ sheep said, and the ending condition is k > = 3

.

ends when k > = 3, that is, whether I meets the conditions does not affect the final result, only depends on whether k meets the conditions

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e39688-44526.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e39688-44526.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?