Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

create phone number javascript

const numbers = [2,6,9,2,4,7,9,2,1,5]

function createPhoneNumber(numbers){
  var format = "(xxx) xxx-xxxx";
  
  for(var i = 0; i < numbers.length; i++)
  {
    format = format.replace('x', numbers[i]);
  }
  
  return format;
}

//Output: "(269) 247-9215"
 
PREVIOUS NEXT
Tagged: #create #phone #number #javascript
ADD COMMENT
Topic
Name
9+5 =