let str = "one two three";
let fixRegex = /(\w+)\s(\w+)\s(\w+)/; // Change this line
let replaceText = "3$ 2$ 1$"; // Change this line
let result = str.replace(fixRegex, replaceText);
Your browser information:
User Agent is: Mozilla/5.0 (Linux; Android 8.1.0; Redmi 5A) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.101 Mobile Safari/537.36.
Challenge: Use Capture Groups to Search and Replace
Read the lesson more carefully and pay attention to the example! The dollar sign comes before the number and the number goes after it like this $3 $2 $1, that’s all the problem is.