vendredi 23 octobre 2015

if statement in Javascript function

I am beginner in Javascript I am always getting true returned whatever the values of my variables, It should return true if a and b are both even, but false otherwise. Thanks for your help.

http://ift.tt/1R0nH43

var a = 4;
var b= 5;
function areBothEqual (a, b) {
    if(a===b) {
        return true;
    }else {
        return false
        
    }
}

var result = areBothEqual();
document.write(result)

Aucun commentaire:

Enregistrer un commentaire