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 number in javascript?
What is the difference between script type and the script language attributes?
Where javascript variables are stored?
What's relationship between JavaScript and ECMAScript? And What are JavaScript types?
How many types of functions are there in javascript?
Explain javascript debounce function?
What does "1"+2+3 evaluate to?
What is null in js?
How to capture the Image width and height using QTP script ? Kindly answer plz.... Thanx in adavance...
How will you explain closures in javascript? When are they used?
Explain how to read and write a file using javascript?
Are javascript variables case sensitive?
Can I declare a variable as CONSTANT in JavaScript?
How can I learn javascript fast?
What is event bubbling in JavaScript?