The Sum of All Fears Challenge


                    
    document.getElementById("submit-btn").addEventListener("click", function () {
        let k = parseInt(document.getElementById("kValue").value);
        SOAF(k);
        console.log("Hello")
     })
    function SOAF(k) {
    //Step 1: Get user data.
        let givenArray = [10, 4, 15, 23, 7]
        let output = "";
        //Step 2: Run Algorithm
        for (let i = 0; i < givenArray.length; i++) {
            for (let x = (i + 1); x < givenArray.length; x++) {  
                if (k == givenArray[i] + givenArray[x]) { 
                    output = "Yes, kValue is Present!"
                }
            }
        }
        if (output == "") {
            document.getElementById("output").innerHTML = `No, kValue is not Present`;
        }
        else {
            document.getElementById("output").innerHTML = `${output}`;
        }
    };
        function ClearAll() {
            document.getElementById("kValue").value = "";
            document.getElementById("output").innerText = "";

        }