I am trying to pick the larger of 5 numbers and sometimes there is a tie. I would like to prioritize variable c1 if there is a tie. This data is from a quiz I am writing.
var c1 = 2; // Takes priority if there is a tie.
var c2 = 1;
var c3 = 2;
var c4 = 0;
var c5 = 0;
I don’t really see why you want the value of c1 in case of a tie. If c1 and c3 have the same value, as in your example, the largest value will be the same regardless of which one you pick. Or am I missing something?
Yes that is correct. There is more too that variable that I choose though which I think is why I need the arguments for it. Depending on which variable is larger and is prioritized I will be running another function to load a specific video. This is what I have thus far but it ignores if there is a tie. If there is a clear larger value, ie 3, then it chooses that one. But when there is a tie it fails.
Yay! ScallioXTX that works perfect! I like the method because it’s intuitive! I am somewhat new to javascript so it’s hard to think of other possibilities until I have seen or tried other variations. Thanks a ton!