Skip to content

Commit ce84260

Browse files
merriamboneskull
authored andcommitted
Update 'Arrow Function' wording for clarity. [ci skip]
(minor doc change). Saw a surprising number of issues and stack overflow questions about using arrow functions, so updated the documentation to be explicit about the lexical binding of 'this'.
1 parent 9594ea0 commit ce84260

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ describe('Array', function() {
254254

255255
## Arrow Functions
256256

257-
Passing [arrow functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) ("lambdas") to Mocha is discouraged. Due to the lexical binding of `this`, such functions are unable to access the Mocha context. For example, the following code will fail due to the nature of lambdas:
257+
Passing [arrow functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) ("lambdas") to Mocha is discouraged. Lambdas lexically bind `this` and cannot access the Mocha context. For example, the following code will fail:
258258

259259
```js
260260
describe('my suite', () => {

0 commit comments

Comments
 (0)