fix(curriculum): update recursion check to support arrow function syntax (#66914)

This commit is contained in:
Zeenat Lawal
2026-04-16 08:20:01 +01:00
committed by GitHub
parent ce6ce7bbc2
commit a6484203e1
@@ -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*\(/));
```