Re:JavaScript Getter-Setter Pyramid
by kangoo1707 on Wednesday December 19, 2018 @10:54AM
(#18716465)
It doesn't have to be named, your second example still works
[ Parent
| on HN ]
naming anonymous functions can provide some clarity in stack traces however
I got the syntax right? Was completely guessing.
Re:JavaScript Getter-Setter Pyramid
by basil-rash on Wednesday December 19, 2018 @02:55PM
(#18718913)
Yep. Nowadays you'd be more likely to see it as:
return () => {
const next = i;
i = i * 2;
return next;
}
But in this case the two are equivalent.