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 webassembly good for?
Is javascript used for backend?
What is the difference between call & apply?
What is slug in javascript?
What is javascript ‘strict mode’?
What is spread syntax?
What is difference between java and javascript?
Why is java better than javascript?
Explain typecasting in javascript?
What is dom in javascript?
What are JavaScript Data Types?
List few advantages of using javascript?
Write a way by which you can do something on the close of the window ?
What is use strict in javascript?
all possible test cases for normal number field,name field date field,check box,