From ffa48c45b0271ff50ce1b486863f36bed05b7107 Mon Sep 17 00:00:00 2001 From: ak Date: Tue, 27 Jun 2023 22:59:32 -0700 Subject: [PATCH] fixed find implementation --- src/LinkedList.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LinkedList.js b/src/LinkedList.js index 6f7751c..43a896e 100644 --- a/src/LinkedList.js +++ b/src/LinkedList.js @@ -88,12 +88,12 @@ export const LinkedList = () => { for (let i = 0; i < CLU.totalNodes; i++) { // if node value matches, set to true if (MCP.currentNode.value === value) { - bool = true; + return i; } // otherwise set to next node MCP.currentNode = MCP.currentNode.nextNode; } - return bool; + return null; } // print Nodes out and preview them in the console const toString = () => {