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 causes memory leaks?
What is unobtrusive javascript?
Are Typescript and Javascript the same?
What's the Difference Between Class and Prototypal Inheritance?
How to get value from a textbox?
How do I view javascript files in chrome?
How to clone an object in javascript?
How do I open javascript in chrome?
What is let keyword in typescript?
Explain the for-in loop?
What is the difference between client side javascript and server side javascript.
What are self invoking functions?
What is spread operator?
Event bubbling and Event Capturing in JavScript?
Is javascript the future?