From 3c54d422a30ecd0090ea5679d46e0264be3a4336 Mon Sep 17 00:00:00 2001 From: Techwizz Date: Fri, 15 Sep 2023 17:21:29 -0600 Subject: [PATCH] Fixed invalid definition for updatedContent in addWordToFile() --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 139cb13..729e618 100644 --- a/index.js +++ b/index.js @@ -120,13 +120,15 @@ function addWordToFile(filePath, dataArray, word) { return; } + let updatedContent; + if (!data.trim()) { console.log(filePath + ' is blank, not adding new line.'); updatedContent = word; } else { // Append new line and word - const updatedContent = `${data.trimRight()}\n${word}`; + updatedContent = `${data.trimRight()}\n${word}`; } // Write the new content to file