if value is between two numbers

前端 未结 5 2063
无人共我
无人共我 2020-12-18 23:39

I want to be able to test whether a value is within a number range. This is my jQuery code...

if ((year < 2099) && (year > 1990)){
    return \         


        
5条回答
  •  南方客
    南方客 (楼主)
    2020-12-19 00:13

    If you don't like the boolean operator, you could always use nested if statements:

    if (1990 < year)
    {
        if( year < 2099)
            return 'good stuff';
    }
    

提交回复
热议问题