Skip to content

Conversation

ramwin
Copy link

@ramwin ramwin commented Jan 22, 2017

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.

@ramwin
Copy link
Author

ramwin commented Jan 22, 2017

I have found the same issue here. Hope someone will merge it early.

@FlorianWendelborn
Copy link

Am I missing something or should evens be 0, 2, 4, 6, ..., 8?

@ramwin
Copy link
Author

ramwin commented Jan 23, 2017

@dodekeract Yes, it's better to use [2, 4, 6] other than [1, 2, 3]. Accepted.

@Pentatool15
Copy link

# --("hello world") ; {String.log} ;
<*Var.[x-5+y+2x]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants