Range Check

MediumAcc. 93.4%
+25 XP 10

Global Validity

Check if every single number in the array is between min and max (inclusive).

The Assignment

Your function receives an array nums, a min, and a max.

  1. Use a loop to scan the array.
  2. If any element is found outside the range, print false and exit.
  3. If the entire loop finishes without exit, print true.

01EXAMPLE 1

Inputnums=[5, 10], min=1, max=10
Outputtrue

Explanation: All are in range.

Constraints

  • Return a boolean string.
  • Stop early on the first violation.
ArraysLogic
JavaScript
Loading...
2 Hidden

Input Arguments

nums[5,10]
min1
max10

Expected Output

true

Click RUN to test your solution