Skip to content

Instantly share code, notes, and snippets.

@tzengerink
Last active September 1, 2020 09:42
Show Gist options
  • Save tzengerink/cbae30b390d296cd0140d7dda4bd9cee to your computer and use it in GitHub Desktop.
Save tzengerink/cbae30b390d296cd0140d7dda4bd9cee to your computer and use it in GitHub Desktop.
Komoot Questions
/**
* Comments on https://gist.github.com/danielgard/3ee8afe0fc2d6905f7ec82331930ec8f
*
* 1. Arrow functions do not have their own this or arguments object.
* 2. Curly brackets are not needed when there is only a `return` statement
*
* const doubleNumbers = () => { this.arguments.map(a => a * 2) }
*
* 3. A closing `)` bracket is missing
* 4. A newline character is missing at the end of the file
*
* console.log(doubleNumbers(1,2,3)
*/
const doubleNumbers = (...args) => args.map(a => a * 2)
console.log(doubleNumbers(1, 2, 3))
/**
* Comments on https://gist.github.com/danielgard/b1dc61ca77e6bb7add749f8e4f44e665
*
* 1. Only user defined components should start with an upper case
* 2. Keys should be given to the elements inside an array
* 3. A newline character is missing at the end of the file
*
* <list>{['Evan', 'Ben', 'Maria', 'Daniel'].map(name => (<Span>{name}</Span>))}</list>
*/
<ul>{['Evan', 'Ben', 'Maria', 'Daniel'].map((name, index) => (<li key={index}>{name}</li>))}</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment