Create Phone Number from Given Array

Question: Write the function to return formatted Phone Number for given array.

Answer:

function formatPhoneNumber(numbers) {

return numbers.join('').replace(/(\d{3})(\d{3})(\d{4})/,'($1) $2-$3');

}