mardi 20 août 2019

Uncaught SyntaxError: Unexpected identifier - Line 17

I'm practicing javascript and I stopped at this part, I didn't understand the error, I'm new to the language, someone help me?

const a = 10;
const b = 33;

function sum(a, b){
    return parseInt(a) + parseInt(b);  
}

document.querySelector("#calculate").addEventListener("click", function(){
    let valueA = document.querySelector("#valueA").value;
    let valueB = document.querySelector("#valueB").value;

    if(valueA.length > 0 && valueB.length > 0){   
        alert sum(valueA, valueB);
    }else{
        alert("Enter a value for to the calculation!");  
        }
});




Aucun commentaire:

Enregistrer un commentaire