Javascript Boolean Operator Question 2

Introduction

We would like to make sure that a number is within our range.

let valueToTest = 2;

if //your code here
    console.log("The value is less than 3 and greater than 0");
} else {
    console.log("The value does not meet the needed criteria");
}


let valueToTest = 2;

if ((3 > valueToTest) && (valueToTest > 0)) {
    console.log("The value is less than 3 and greater than 0");
} else {
    console.log("The value does not meet the needed criteria");
}



PreviousNext

Related