mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(curriculum): update recursion check to support arrow function syntax (#66914)
This commit is contained in:
+2
-1
@@ -83,7 +83,8 @@ assert.equal(fibonacci(15), 610);
|
||||
You should not use recursion in your code.
|
||||
|
||||
```js
|
||||
const bodyMatch = __helpers.removeJSComments(code).match(/function\s+fibonacci\s*\([^)]*\)\s*\{([\s\S]*)\}/);
|
||||
const funcStr = __helpers.removeJSComments(fibonacci.toString());
|
||||
const bodyMatch = funcStr.match(/^[^{]*\{([\s\S]*)\}[^}]*$/) || funcStr.match(/=>\s*([\s\S]+)$/);
|
||||
assert(bodyMatch && !bodyMatch[1].match(/\bfibonacci\s*\(/));
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user