Can you write a random integers function to print integers with in a range?
Answer / 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 |
Is webassembly faster than javascript?
What is the difference between java and java script?
Does spacing matter in javascript?
What is the difference between == and ===? Which one would you use?
Is javascript backend or frontend?
What is a currying function?
How to manage exception handling in javascript?
What is call(), apply(), and bind()?
What is an example of javascript?
How Does Function Hoisting Work in JavaScript?
Explain window.onload and ondocumentready?
Which is faster jquery or javascript?