JS数字区间比较大小的写法

正确的写法:

if (realValue >= 0 && realValue <= 5) {
    console.log('正确写法');
}

错误的写法:

if (0 <= realValue <= 5) {
    console.log('错误写法');
}

 

posted @ 2023-04-17 17:10  ZJTL  阅读(53)  评论(0编辑  收藏  举报