File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ A function is pure if the return value is only determined by its
179
179
input values, and does not produce side effects.
180
180
181
181
``` js
182
- const greet = (name ) => ' Hi, ' + name
182
+ const greet = (name ) => ` Hi, ${ name} `
183
183
184
184
greet (' Brianne' ) // 'Hi, Brianne'
185
185
```
@@ -189,9 +189,7 @@ As opposed to each of the following:
189
189
``` js
190
190
window .name = ' Brianne'
191
191
192
- const greet = () => {
193
- return ' Hi, ' + window .name
194
- }
192
+ const greet = () => ` Hi, ${ window .name } `
195
193
196
194
greet () // "Hi, Brianne"
197
195
```
@@ -202,10 +200,10 @@ The above example's output is based on data stored outside of the function...
202
200
let greeting
203
201
204
202
const greet = (name ) => {
205
- greeting = ' Hi, ' + name
203
+ greeting = ` Hi, ${ name} `
206
204
}
207
205
208
- greet ()
206
+ greet (' Brianne ' )
209
207
greeting // "Hi, Brianne"
210
208
```
211
209
You can’t perform that action at this time.
0 commit comments