mercredi 27 novembre 2019

Writing an If statement to = a number but not allow for than another [duplicate]

This question already has an answer here:

Im writing an if statement that allows to display a choice based on users input,

Im basically trying to say if something like if they pick 2-4 nights then allow the option.

This is what i've written:

if (userObj.guests = 2 || userObj.guests <=4 && userObj.dayDifference <=10 ) {
    $('.motel_container').removeClass('disable')
}

How can i only allow the if statement to work if they pick 2 - 4 nights only.

Aucun commentaire:

Enregistrer un commentaire