From f7761478a1e7bc245aef9d7f4699165a3ff0a2bd Mon Sep 17 00:00:00 2001 From: Jefin Mathew <56828393+JefinDX@users.noreply.github.com> Date: Wed, 9 Oct 2024 17:27:22 +0530 Subject: [PATCH 1/2] Update index.js the 'return' statement should be outside the loop. Signed-off-by: Jefin Mathew <56828393+JefinDX@users.noreply.github.com> --- .../9-final-solution-exercise-read-write-files/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nodejs-files/9-final-solution-exercise-read-write-files/index.js b/nodejs-files/9-final-solution-exercise-read-write-files/index.js index 7df53274..1d3c0b96 100644 --- a/nodejs-files/9-final-solution-exercise-read-write-files/index.js +++ b/nodejs-files/9-final-solution-exercise-read-write-files/index.js @@ -28,13 +28,12 @@ async function findSalesFiles(folderName) { results.push(`${folderName}/${item.name}`); } } - - return results; } } catch (error) { console.error('Error reading folder:', error.message); throw error; } + return results; } async function main() { From e2cb285308fc4baff06098715743dc591c8227ad Mon Sep 17 00:00:00 2001 From: Jefin Mathew <56828393+JefinDX@users.noreply.github.com> Date: Wed, 9 Oct 2024 17:30:59 +0530 Subject: [PATCH 2/2] Update index.js the 'return' statement should be outside the loop. Signed-off-by: Jefin Mathew <56828393+JefinDX@users.noreply.github.com> --- nodejs-files/9-exercise-read-write-files/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nodejs-files/9-exercise-read-write-files/index.js b/nodejs-files/9-exercise-read-write-files/index.js index 225cb99d..a7352191 100644 --- a/nodejs-files/9-exercise-read-write-files/index.js +++ b/nodejs-files/9-exercise-read-write-files/index.js @@ -42,13 +42,12 @@ async function findSalesFiles(folderName) { results.push(`${folderName}/${item.name}`); } } - - return results; } } catch (error) { console.error('Error reading folder:', error.message); throw error; } + return results; } async function main() {