es6features
es6features copied to clipboard
add some definition statements in the chapter of Arrows
When the first time I was learning the es6features. I directly copy the code
var odds = evens.map(v => v + 1);
var nums = evens.map((v, i) => v + i);
var pairs = evens.map(v => ({even: v, odd: v + 1}));
to the console page of my chromium web browser's developer tools.
Without doubt, the errors shows like this:
VM347:1 Uncaught ReferenceError: evens is not defined
at <anonymous>:1:12
(anonymous) @ VM347:1
Which is very disappointing.
So I add the definition statement like var evens = [2, 4, 6];.
I think some extra definition statements will make it feel better especially for new users.
I have found the same issue here. Hope someone will merge it early.
Am I missing something or should evens be 0, 2, 4, 6, ..., 8?
@dodekeract Yes, it's better to use [2, 4, 6] other than [1, 2, 3]. Accepted.
# --("hello world") ; {String.log} ;
<*Var.[x-5+y+2x]