Why do the use of conditional judgments => and >= in JavaScript produce different results?
ringa_lee
ringa_lee 2017-05-19 10:11:47
0
6
568

'use strict';
var arr = ['Bart', 'Lisa', 'Adam'];
var len = arr.length-1;
while(len> =0){
alert('Hello,' arr[len]);
len--;
}//This will pop up normally, and it will stop after popping up after 3 times.

'use strict';
var arr = ['Bart', 'Lisa', 'Adam'];
var len = arr.length-1;
while(len= >0){
alert('Hello,' arr[len]);
len--;
}//After 3 normal pop-ups, many Hellos will pop up, undefined , and then the browser crashes.

Why is this happening?

ringa_lee
ringa_lee

ringa_lee

reply all(6)
Ty80

I’m on my knees...

>=是大于等于运算符,=>那是ES6的箭头函数操作符啊,而且你还加了'use strict', the proper native ES6 has started...

phpcn_u1582

Arrow function

大家讲道理
>=大于等于 和 <=小于等于
=>这个是箭头函数 ()=>{}
仅有的幸福

The problem with JS parsing, => is the arrow function

我想大声告诉你

Being hit by the perfect hit I mentioned before, it’s hard to tell whether it’s >=, <=, =>, =<

漂亮男人

There are still so many tricks in js, and I accidentally forget that I am writing code

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template