Create Phone Number
题目
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:
1 | 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!
思路
略
答案
1 | function createPhoneNumber(numbers) { |
Your order, please
题目
Your task is to sort a given string. Each word in the string will contain a single number. This number is the position the word should have in the result.
Note: Numbers can be from 1 to 9. So 1 will be the first word (not 0).
If the input string is empty, return an empty string. The words in the input String will only contain valid consecutive numbers.
Examples
1 | "is2 Thi1s T4est 3a" --> "Thi1s is2 3a T4est" |
思路
略
答案
1 | function order(words) { |

