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 a function an object?
What is null variable?
Explain prototypal/differential inheritance?
What is a prompt box in javascript?
Create an array in javascript with a list of 4 colors, assign that array to the variable, ‘colors’.
What are the ways to define a variable in javascript?
How would you compare two objects in JavaScript?
What are all the looping structures in javascript?
What is "this"?
What are the types used in javascript?
What are exports & imports?
What is rest parameters in javascript?