본문 바로가기
코테연습

25.Create Phone Number

by hxunz 2022. 4. 2.

Description:

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.

Example

createPhoneNumber([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) // => returns "(123) 456-7890"

The returned format must be correct in order to complete this challenge.
Don't forget the space after the closing parentheses!

 

 

function createPhoneNumber(numbers){
  return '(' + numbers[0] + numbers[1] + numbers[2] + ') ' + numbers[3] + numbers[4] + numbers[5] + '-' + numbers[6] + numbers[7] + numbers[8] + numbers[9]
}

냅다 일일이 넣어버리기,,, 

'코테연습' 카테고리의 다른 글

27.Counting Duplicates  (0) 2022.04.03
26.Find The Parity Outlier  (0) 2022.04.02
24.Bit Counting  (0) 2022.04.01
23.Who likes it?  (0) 2022.04.01
22.Array.diff  (0) 2022.03.31

댓글