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

suggestion: additional info on .map() syntax #201

Open
mfoos opened this issue Jan 3, 2020 · 0 comments
Open

suggestion: additional info on .map() syntax #201

mfoos opened this issue Jan 3, 2020 · 0 comments

Comments

@mfoos
Copy link

mfoos commented Jan 3, 2020

Manipulating Page -> Bibliographic Citations

Hey folks,

I have to compliment you on the skimability of this book (even if that's a dubious compliment), because I personally need a big-picture before I can go into details. Also forgive me if I missed this info skimming, but I don't think I did because I did a ctrl+F for "map".

Here are the two things I found confusing:

  1. Inconsistent use of parens: map is introduced with data.map((x) => { return x.slice(0, 2) }) but in later examples, the anonymous parameter (?) is used without parens.: link.textContent.split(',').map(s => s.trim())

  2. The curly braces inside the parameter parens:

.map(({node, text}) => (
      {node,
       text: text.map(cite => `<a href="../bib/#${cite}">${cite}</a>`)}
    ))

I also want to note that while I believe in the ol "learn yourself by googling", this was not terribly fruitful for me because of the multiple versions of syntax available in docs around the interwebs (see: https://stackoverflow.com/questions/4146984/curly-braces-inside-javascript-parameters-for-functions

Thanks! Awesome resource!

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