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 |
What is an enum
Which operator is used to assign a value to a variable?
How to count the number of element in an array using javascript?
Why do we need hoisting in javascript?
What is local and global scope?
What does question mark mean in react?
Explain what is javascript? List some data types supported by javascript?
how to read and write a file using JavaScript?
What does "1"+2+4 evaluate to?
How to find the selected radio button immediately using the 'this' variable?
Write JavaScript code to use file system in binary format?
Can javascript code be broken in different lines?