function createPhoneNumber(arr) {
if(arr.length < 10) {
return 'Your phone number is not from this country'
}
arr.splice(0,0, '(')
arr.splice(4,0, ')')
arr.splice(5,0, ' ')
arr.splice(9,0, '-')
return arr.join('');
};
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Discussion on: Daily Challenge #178 - Create Phone Numbers
For further actions, you may consider blocking this person and/or reporting abuse