Replace() method

I have seen a lot of code that is written like:

replace(/./g, "...")

What does the . (period sign) mean here?

Many thanks in advance.

The “.” is a wildcard method that matches anything. So /hu./g would match hug, hum, hud, etc.

1 Like

I see, thank you very much.

1 Like