Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Can you write a random integers function to print integers with in a range?



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

Post New Answer

More JavaScript Interview Questions

Is webassembly faster than javascript?

0 Answers  


What is the difference between java and java script?

9 Answers   IWW, Wipro,


Does spacing matter in javascript?

0 Answers  


What is the difference between == and ===? Which one would you use?

0 Answers  


Is javascript backend or frontend?

0 Answers  


What is a currying function?

0 Answers  


How to manage exception handling in javascript?

0 Answers  


What is call(), apply(), and bind()?

1 Answers  


What is an example of javascript?

0 Answers  


How Does Function Hoisting Work in JavaScript?

0 Answers  


Explain window.onload and ondocumentready?

0 Answers  


Which is faster jquery or javascript?

0 Answers  


Categories