please tell why i got 0 as well in output when i defined the range from 1 to 4
It does not look as though you saved your code.
For future posts, please do not paste a screenshot. It is difficult to work with, and you are less likely to get help this way.
the last closed parenthesis should be after the number 1.
console.log(Math.floor(Math.random() * 4) + 1);
But to avoid problems like that I think you can use something like this instead which does the same thing:
let math = Math.floor(Math.random() * 4) + 1; console.log(math);
For what it’s worth, I highly recommend never using
math as a variable name.
It was just a test : D
this is very nice place for learners your help helps me to move forward without stucking to the problem.