How to get only random number between 1 to 10?

 Posted by Rajesh_Kumar on 2/17/2014 | Category: JavaScript Interview questions | Views: 2660 | Points: 40
Answer:

Just multiply with 10,then we can get output between 1 to 10 as

alert(Math.floor((Math.random() * 10)));


Output would be any value between 1 to 10.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response