44 lines
1007 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: 587d7b8d367417b2b2512b5b
title: 学习函数式编程
challengeType: 1
forumTopicId: 301233
---
# --description--
函数式编程是一种方案简单、功能独立、对作用域外没有任何副作用的编程范式。
`INPUT -> PROCESS -> OUTPUT`
函数式编程:
1功能独立——不依赖于程序的状态比如可能发生变化的全局变量
2纯函数——同一个输入永远能得到同一个输出
3有限的副作用——可以严格地限制函数外部对状态的更改。
# --instructions--
freeCodeCamp 成员在 love tea 的故事。
在代码编辑器中,已经为你定义好了`prepareTea``getTea`函数。调用`getTea`函数为团队准备 40 杯茶,并将它们存储在`tea4TeamFCC`变量里。
# --hints--
`tea4TeamFCC`变量里应有 40 杯为团队准备的茶。
```js
assert(tea4TeamFCC.length === 40);
```
`tea4TeamFCC`变量里应有 greenTea。
```js
assert(tea4TeamFCC[0] === 'greenTea');
```
# --solutions--