Generate random whole numbers javascript
/* If 1 argument is given, minimum will be set to 0 and maximum to this argument
* If 2 arguments were given, the fist would be the minimum and the second the maximum
* The function will return an integer in [min, max[
*/
const Math.randint => (min,max) {
[min,max] = (max===undefined)?[0,min]:(min>max)[max,min]:[min,max];
return Math.floor(Math.random*(max-min)+min);
}var randomWholeNumber = Math.floor(Math.random() * 20);
function randomWholeNum() {
return Math.floor(Math.random() * 10);
}
console.log(randomWholeNum());
Also in JavaScript:
- file system replace line js
- return value from javascript function
- angular http client
- npm ERR! Unexpected end of JSON input while parsing near '...ty":"sha512-2GTXt3b2Q'
- how to use labels in javascript
- express img folder
- w3 cookies js
- javascript read query parameters
- picker change event react native
- jquery scroll to top of div
- javascript boolean regex match
- add option to select jquery
- jquery form validation
- rails call multiple variable format json
- how to populate a list in html with javascript
- node js split
- javascript onkeydown
- change view port of svg with javascript
- pyspark from_json example
- how to check if a string has only alphabets in javascript
- percentage formula in javascript
- truncate javascript
- check if a key exists in an object javascript
- vowels consonants javascript