Can anyone explain to me why my expression doesnt work?
It wont let me interprete the prompt(“lol”); statement. Can anyone explain why?
Try it by changing your
var allowedNumbers = /[3-18]/;
into
var allowedNumbers = [3,18];
nvm, it works!
But I have another problem now, and it is my if statement that i try to run. I get no output.
But the thing with your expression [3,18] is not the same thing as [3-18]. I want to match the numbers 3,4,5,6,…,18. With your expression it will only look for the numbers 3 and 18.
@codewhiz09204,
You will have to use the IF condition
allowNumber[0] < guess && guess < allowedNumber[1]
using the less than comparison operator
together with the logical and operator
[3,18] is an Array with 2 Elements
if you look in the left-hand column under the =header= Methods
you see all predefined functions of the Array-prototype
Honetly the code should work as I wrote it, but I dont know why?
Thank you very helping me out! I did a lazy solution by doing the following code: /[3,4,5,6,…,18]/