Upgrade to Pro — share decks privately, control downloads, hide ads and more …

forループを越えて / beyond for loop

forループを越えて / beyond for loop

#SurviveJS05 発表資料
高階関数を活用してコードを読みやすくする話です

Shunsuke Watanabe

October 12, 2018
Tweet

More Decks by Shunsuke Watanabe

Other Decks in Programming

Transcript

  1. ؔ਺Λ໭Γ஋ͱ͠ ͯฦؔ͢਺ const createCounter = () => { var number

    = 0; return () => { number++; return number; }; }
  2. const dummyTodos = [ { id: 1, title: 'aaaa', done:

    true }, { id: 2, title: 'aaaa', done: false }, ]; const TodoList = ({ todos }) => ( <div> {todos.map(todo => ( <TodoItem key={todo.id} {...todo} /> ))} </div> );
  3. const double = v => v * 2 const over5

    = v => v > 5 const a = [1,2,3] .map(double) .filter(over5)