0
您可以在JavaScript for循环中使用复合条件语句吗?在JavaScript for循环中使用复合条件语句
下面是一个例子,
//using a compound conditional statement
//within a for loop, JavaScript
for (var i=0; i < res.length && i < 5; i++) {};
//or
for (var i=0; i < res.length || i < 5; i++) {};
事实上,你的第二个例子可能会无限地运行这样一个逻辑错误的例子,或者只是偶然的讽刺? – Wiseguy
这是一个像任何其他的逻辑陈述;任何错误将是PEBKAC。 –
肯定会引起偶然的讽刺! :) – TheBrent