From a6484203e14536daf8a31b374292393cd14a7188 Mon Sep 17 00:00:00 2001 From: Zeenat Lawal Date: Thu, 16 Apr 2026 08:20:01 +0100 Subject: [PATCH] fix(curriculum): update recursion check to support arrow function syntax (#66914) --- .../lab-nth-fibonacci-number-js/7a97b79c096ecb000d03bd36.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/curriculum/challenges/english/blocks/lab-nth-fibonacci-number-js/7a97b79c096ecb000d03bd36.md b/curriculum/challenges/english/blocks/lab-nth-fibonacci-number-js/7a97b79c096ecb000d03bd36.md index 6ae592c4e8c..807bb0dda19 100644 --- a/curriculum/challenges/english/blocks/lab-nth-fibonacci-number-js/7a97b79c096ecb000d03bd36.md +++ b/curriculum/challenges/english/blocks/lab-nth-fibonacci-number-js/7a97b79c096ecb000d03bd36.md @@ -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*\(/)); ```