Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

random number javascript

function uniqueNumber(count) {
  let defaultNumber = 4413277523420
  let convertToArray = defaultNumber.toString().split("")
  let sliceNumber = convertToArray.slice(0, count)
  let randomNumber = Math.floor((Math.random() * +sliceNumber.join("")));
  
  if  (randomNumber.toString().split("").length < count) {
      randomNumber = Math.abs(randomNumber - +sliceNumber.join(""))
  }
 
  return randomNumber
}
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #random #number #javascript
ADD COMMENT
Topic
Name
3+9 =