Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Item 4) Why aren't anonymous arrow functions being proudly advertized? #187

Open
switheyw opened this issue Jul 3, 2017 · 0 comments
Open

Comments

@switheyw
Copy link

switheyw commented Jul 3, 2017

First off: Thanks a whole lot to timoxley and others who took a lot of time out of their busy days to create this self-paced functional-javascript learning app. I'm finding it very useful. A lot of my Javascript learning is book learning or is used on largish apps which have to get finished, leaving me with little time to experiment.

I think my function (below) is very easy to read. I've been watching Professor. Frisby's lessons on Egghead and he encourages top to bottom readability in chained functions.

function getShortMessages(messages) {
   return  messages
          .map( json => json.message)
          .filter( sentence =>  sentence.length < 50 )
}

When I looked provided answer, I couldn't easily follow the logic flow.
I assume that the best examples of their kind should be added to the functional javascript workshop so that we don't get beginners off on the wrong foot.

function getShortMessages(messages) {
   return messages.filter(function(item) {
     return item.message.length < 50
       }).map(function(item) {
          return item.message
       })
}

Let's propagate anonymous arrow functions. I believe that the ES6 transformers available will produce code which can run everywhere.

Stephen Wright

@switheyw switheyw changed the title Why aren't anonymous arrow functions being proudly advertized? Item 4) Why aren't anonymous arrow functions being proudly advertized? Jul 3, 2017
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

No branches or pull requests

1 participant