I am using variables for my numbers. I require the smallest number and so I use min()
to achieve that but if I have multiple values it will only take them in chronological order.
var a = 98 ; var b = 82 ; var c = 61 ; var d = 80 ; var e = 89 ; var f = 61 ; var g = 82 ;
var z = Math.min ( a , b , c , d , e , f , g ) ;
var y = " this is the final value that determines everything ! " ;
if ( a == z ) { y = " a " } else if ( b == z ) { y = " b " } else if ( c == z ) { y = " c " } else if ( d == z ) { y = " d " } else if ( e == z ) { y = " e " } else if ( f == z ) { y = " f " } else if ( g == z ) { y = " g " } else { " you are an invalid " } ;
// if ( " you are an invalid " == true ) { " then you will burn in hell for all of your sins " }
In this example y
equals both c
and f
, but we'll ignore f
in this case. How can I get both values for further comparison? They are apart of a more complex system and the values are always changing so that sometimes there are more or less occurrences of the same values and some have noneatall.
(I thought about it for a bit while typing upto this point and think I have solved it, we will see)
But I guess that now I have a known minimum I can just compare all of the original values with the y
factor.
(Okay, so I have tried alot of different things but they didn't work or was just repeating myself from before if
statements)
(Maybe I should remove y
? but I need y
to tell me what value it has that is small ! so maybe if I try y = y + "*"
Now I feel I am onto something, proving that typing this problem out has helped me once and for all to solve this for myself)
Let's let me try again from completed scratch:
var a = 98 ; var b = 82 ; var c = 61 ; var d = 80 ; var e = 89 ; var f = 61 ; var g = 82 ;
var z = Math.min ( a , b , c , d , e , f , g ) ;
var y = "" ;
if ( a == z ) { y = y + "a" }; if ( b == z ) { y = y + "b" }; if ( c == z ) { y = y + "c" }; if ( d == z ) { y = y + "d" }; if ( e == z ) { y = y + "e" }; if ( f == z ) { y = y + "f" }; if ( g == z ) { y = y + "g" } ;
// now what do I do now? ~ :\
// how can I break up y for further processing purposes?
// will I take a break from all of this typing and return to my problem at a later time?
// NO! you must complete now or never and die very painful death!
// but it usually works for me to take break?
// NO BREAKS! Now get back to work!
// okay Doctor Proactivation, fine, have it your way then and I will try my best to persevere instead of listening to the other of myself.
yA = y .split ( "" )
// I apologize for my inconstancy earlier, just previously before. But now I hit another wall made out of candystuffs. how can I see how many values there are for y[x]?
yL = y .length
//
// found bug in programme and went back to remove all "else" occurence -___-
// now I need to figure something to do for with my length and apply mind over matter to achieve results ^^'
I will return later to this for my time being.