I need to make an IF in JS code. There are some conditions for the number input:
- allowed numbers: 1, 2, 34, 68, 136, 272, 544
- numbers 545 and above is allowed only when number%5 == 0
- max allowed number is 4000
Is there any easy way how to put these condition into just one IF?
Thank you for the answer.
We can create a function to test the values, testNumber with one if statement, by using Array.includes to test the number and then checking if the value is between 545 and 4000 and is divisible by 5.