vendredi 11 septembre 2020

how to set a is any number in an if statement condition jquery

How wold i go about changing this code so that the number 7 can be replaced with any number between 7 and 16?

    var lvalue = $( ".leave-input" ).val();
    if (lvalue <=  7.29) {
      lvalue = roundDown();
    } else if (lvalue >= 7.3) {
      lvalue = roundUp();
    }

I am trying to round the time the user input ups the nearest hour. I had trouble using time so am now just using the number they input.

To clarify rather then having an if statement for each number, 7, 8, 9 etc. Is there a way to rewrite the current code so "7" can be any number between 7 and 16?

Aucun commentaire:

Enregistrer un commentaire