Can you write a random integers function to print integers with in a range?
Answer Posted / hrpatelsoft@gmail.com
function randomInteger(min, max) {
return Math.floor(Math.random() * (max - min + 1) ) + min;
}
randomInteger(1, 100); // returns a random integer from 1 to 100
randomInteger(1, 1000); // returns a random integer from 1 to 1000
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is decodeuri() in javascript?
What is difference between deep and shallow object coping in javascript?
How does typeof operator work?
What is Number object in JavaScript?
Does javascript support foreach loop?
Taking a developer's perspective, do you think that that javascript is easy to learn and use?
What is output of “20” + 20? In javascript?
Why do we need currying?
What is the difference between ‘function declaration’ and ‘function expression’?
How would you compare two objects in JavaScript?
Is javascript case sensitive language?
What is the difference between JavaScript and jscript?
Are there any iphone Institutes which also train iphone automation testing in Hyderabad?
Is there any ide for javascript?
What is meaning of === in javascript?