See The Code
This Function Displays if any numbers where found that eqauled the total sum.
function getData() { var numberToSearch = document.getElementById("numberToSearch").value; var numbers = getNumbers(); if (numberToSearch == null || numberToSearch == "undefined") { numberToSearch = 0; } console.log(numberToSearch); let result = checkSum(numbers, numberToSearch); if (result) { document.getElementById("results").textContent = "Success : " + sets.toString(); }else{ document.getElementById("results").textContent = "Failed : No numbers in the list provided equaled your search number"; } }

This Function goes thru all the numbers to see if they add up to the sum number.
function checkSum(numArray, totalSum) { sets = []; for (let i = 0; i < numArray.length; i++) { addSum(numArray, numArray[i], totalSum); } if (sets.length > 0) { return true; } return false; }
This Function checks 2 numbers to see if the equal the sum and if true, adds it to an array to save and display to the user.
function addSum(numArray, index, totalSum) { for (let i = 0; i < numArray.length; i++) { if (numArray[i] + index==totalSum) { sets.push(`${numArray[i]} + ${index}=${totalSum}`); } } }