Javascript中的`-->`运算符是什么?

45 浏览
0 Comments

Javascript中的`-->`运算符是什么?

这个问题已经有了答案:

JavaScript中的减减小于\"-->\"运算符是如何工作的?【重复】

我在网上看到一些代码,其中有这个:

document.writeln("

"); for (var line = 10; line --> 0;) { // --> operator here for (var i = 10; i --> 0;) { // --> operator here var s = (Math.floor((Math.random()*2)%2)) ? "╱" : "╲"; document.write(s); } document.writeln(" "); } document.writeln("

");

p { 
  line-height: 18px; 
  font-size: 18px; 
}

这个-->运算符到底是什么,它是做什么用的?

admin 更改状态以发布 2023年5月24日
0
0 Comments

这是一个递减操作(--),后面跟着一个比较操作(>)。通常会在它们之间添加一个空格以便阅读。

0
0 Comments

没有 --> 运算符。

那只是一个后缀自减运算符,紧接着是一个大于号运算符

通常表示为:

for (var i = 10; i-- > 0;) { 

0