I don't understand what is problem in this i think it's right but isn't running!

Tell us what’s happening:

Your code so far


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

Link to the challenge:

you may want to review how to write the placeholders

if you add console.log(result) as last line you can see your string

I have tried this and I didn’t get the output as asked same code.it
gives out put “3$ 2$ 1$”

please use this topic you alread have opened for follow up questions

have you tried adding console.log(result) on a new line after your code to see the value of result?

1 Like

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.

1 Like

:sweat_smile: you are right,didn’t paid !:sweat_smile:

1 Like