Untitled
export function order(words: string): string { const splittedPhrases = words.split(' '); const orderred = splittedPhrases.reduce((accumulator, phrase) => { const copyPhrase = phrase.repeat(1); const currentPosition = copyPhrase.replace( /^\D+/g, '')[0]; return { [currentPosition] : phrase, ...accumulator }; }, {}); return Object.values(orderred).join(' '); }