If x is greater than y

Hi,

There is an error but I couldn’t find it
The rule is?
Kat” This is the number of floors of the block apartment
Pano Katları” this is the floors where the cables are collected, If there is more than one floor here, we take the value of the top panel floor.

The top panel floor value fits if it is greater than the apartment floor.
Kat” 20, “Pano Katları” 18,13,7,3, No warning here
18th floor not bigger than 20th floor
Kat” 10, “Pano Katları” 7,3, There is a warning here
7th floor not bigger than 10th floor
Why is it warning here?

    var kackat = kac_kat.trim();
    var katlararr = katlar_arr[0].trim();
    if( katlararr > kackat ){
    alert("");
    }

Your inputs are probably being treated as text, which compares differently to numbers. You can convert them to integers with the function parseInt().

I did as you suggested, the problem is solved.
Thank you

    var kackat      = parseInt(kac_kat.trim());
    var katlararr   = parseInt(katlar_arr[0].trim());

    if( katlararr > kackat ){
    
    }
Sponsor our Newsletter | Privacy Policy | Terms of Service