Write a function that accepts an array of 10 integers (between 0 and 9), that returns a string of those numbers in the form of a phone number.
function createPhoneNumber(numbers){
var format = "(xxx) xxx-xxxx";
for(var i = 0; i < numbers.length; i++)
{
format = format.replace('x', numbers[i]);
}
return format;
}function createPhoneNumber(numbers){
var format = "(xxx) xxx-xxxx";
for(var i = 0; i < numbers.length; i++)
{
format = format.replace('x', numbers[i]);
}
return format;
}
Also in JavaScript:
- scroll to top
- javascript sleep settimeout
- react image upload component
- airbnb react native eslint
- gradle json simple dependency
- javascript clear localstorage
- check how many of a word is in a string
- set value of input in javascript
- switch (new date().getday())
- get syntethicbaseevent and parameter in react
- javascript 2 decimal float array elements
- set dropdown in jquery
- deep clone array in javascript
- responsive grid using antd
- nesting in Jinja2 expressions
- javascript add option element to select
- reduce function javascript
- transformorigin gsap
- install vue-cli
- set element at index javascript array and create new array
- javascript sum of number in object array
- js extract only numbers from string
- javascript typewriter effect
- shadow in react native