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
How much time it will take to learn javascript?
how to write frame work Architecture in QTP
How to create an array in javascript?
What is the difference between innerhtml and append() in javascript?
Which built-in method returns the calling string value converted to lower case?
What is undefined x 1 in JavaScript?
What would be the result of 3+2+”7″?
What is the difference between remove() and removeChild()?
What do I need to code javascript?
Is javascript enabled on my computer?
Explain mul function in javascript?
What is Browser Object Model?
How to replace all occurrences of a string in JavaScript?
What is a boolean search?
Is JavaScript a case-sensitive language?