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 = () => {