jeudi 22 décembre 2016

Java script unable to identify all variables [on hold]

Hi I'm getting started with JS and still some of the things happening here are a little enigmatic to me. My question is why third variable in my code resultMarcin is not being considered in my simple line of code?

var ageMike = 25;
var ageTom = 30;
var ageMarcin = 90;

var heightMike = 178 * 5;
var heightTom = 150 * 5;
var heightMarcin = 210 * 5;

var resultMike = ageMike + heightMike;
var resultTom = ageTom + heightTom;
var resultMarcin = ageMarcin + heightMarcin;


if (resultMike > resultTom && resultMarcin) {

    alert('Mike wins with score ' + resultMike);

} else if (resultTom > resultMike && resultMarcin) { 

    alert('Tom wins with score' + resultTom);

} else if (resultMarcin > resultMike && resultTom) {

    alert('Marcin wins with score' + resultMarcin);

} else if (resultMike === resultTom && resultMarcin) {

    alert("It's a tie");

}

Aucun commentaire:

Enregistrer un commentaire