inRange
Given a number and a range (lower and upper bounds), return true if the number is within the range (inclusive), and false otherwise.
Examples
inRange(5, 1, 10) → true
inRange(12, 1, 10) → false
inRange(1, 1, 10) → true
Starter code
function inRange(num, lower, upper) {
}
Complexity of the optimal solution
Time O(1), space O(1). This function uses two comparison operators and one logical AND. The number of operations is fixed, so it's a constant time solution.