From c1961f1814bb6e33cccfc8a14914cdf65c58e59f Mon Sep 17 00:00:00 2001 From: Pronay Debnath Date: Tue, 3 Oct 2023 13:19:44 +0530 Subject: [PATCH] Update RecursiveLinearSearch.js --- Recursive/RecursiveLinearSearch.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Recursive/RecursiveLinearSearch.js b/Recursive/RecursiveLinearSearch.js index e0045b11f9..9b02132527 100644 --- a/Recursive/RecursiveLinearSearch.js +++ b/Recursive/RecursiveLinearSearch.js @@ -13,16 +13,16 @@ function recursiveLinearSearch (arr, key, index = 0) { // Base case: If we have searched the entire array and haven't found the key, return -1. if (index === arr.length) { - return -1; + return -1 } // Base case: If the current element matches the key, return its index. if (arr[index] === key) { - return index; + return index } // Recursive case: Continue searching in the rest of the array. - return recursiveLinearSearch(arr, key, index + 1); + return recursiveLinearSearch(arr, key, index + 1) } -export { recursiveLinearSearch }; +export { recursiveLinearSearch }