Ich brauche wirklich Hilfe mit diesem kleinen Problem, ich muss die erste Person nach der höchsten Punktzahl Rang.wie rangiere ich den ersten Platz
//variables where the total value will go for each person
var musT = 0;
var zikT = 0;
var hamT = 0;
// if the spacebar is pressed
document.body.onkeyup = function(e){
if(e.keyCode == 32){
//generate random integers between 1 and 12
var person_0 = Math.floor(Math.random() * 12 + 1);
var person_1= Math.floor(Math.random() * 12 + 1);
var person_2 = Math.floor(Math.random() * 12 + 1);
// add total number of pushups
musT += person_0;
zikT += person_1;
hamT += person_2;
//displaying the total pushups
$("#musT .box").html(musT);
$("#zikT .box").html(zikT);
$("#hamT .box").html(hamT);
}
Ich möchte die höchste Zahl in einem besseren Weg Rang
//ranking the top person
if(musT > zikT && hamT){
$("#first").html("Musa: " + musT);
} if(zikT > musT && hamT){
$("#first").html("Zikria: " + zikT);
} if(hamT > musT && zikT){
$("#first").html("Hamza: " + hamT);
}
}
Was sind Musa, Zikria und Hamza? Wo benutzt du person_0, person_1 und person_2? – derloopkat