Skip to content

Instantly share code, notes, and snippets.

@entaku0818
Last active January 30, 2018 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save entaku0818/6f19c634658cee78887a4318cc806078 to your computer and use it in GitHub Desktop.
Save entaku0818/6f19c634658cee78887a4318cc806078 to your computer and use it in GitHub Desktop.
# Imperative
const people = ['Amanda', 'Geoff', 'Michael', 'Richard', 'Ryan', 'Tyler']
const excitedPeople = []
for (let i = 0; i < people.length; i++) {
excitedPeople[i] = people[i] + '!'
}
# Declarative
const people = ['Amanda', 'Geoff', 'Michael', 'Richard', 'Ryan', 'Tyler']
const excitedPeople = people.map(name => name + '!')
@entaku0818
Copy link
Author

Imperativeは処理重視の考え方
Declarativeは結果重視の考え方

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