admin 发表于 2024-5-25 17:38:19

!逻辑非运算是一个单运算,把true变为false,把false变为ture

! true; // 结果为false
! false; // 结果为true
! (2 > 5); // 结果为true布尔值就经常在判断语句中使用,例如:
var age = 15;
if (age >= 18) {
    alert('adult');
} else {
    alert('teenager');
}

页: [1]
查看完整版本: !逻辑非运算是一个单运算,把true变为false,把false变为ture