问题
I am confuse about this symbol (<-) in Chrome DevTools

It's return value or console value?
When I run this while loop
var i = 0;
while (i < 5) {
console.log(i);
i++;
}
the console log spits out 4 twice, the last 4 have a (<-) in a front, what's meaning?
回答1:
This has to do with the nature of the eval
function. Note that:
var i = 0, j = while(i < 5) { i++; };
Produces a compile error. However,
var i = 0, j = eval('while(i < 5) { i++; }');
Assigns the value 4
to j
. Why is this? Quoting from MDN:
eval()
returns the value of the last expression evaluated.
So in short, it evaluates all the calls to console.log
in your expression, then also logs the return value from the eval
-ed expression itself, which just happens to be the result of the last i++
.
来源:https://stackoverflow.com/questions/21820746/chrome-devtools-whats-this-arrow-meaning