What does /g do?

Hi everyone,

I came across this code on codewars:

function maskify(cc) {
  return cc.slice(0, -4).replace(/./g, '#') + cc.slice(-4);
}

and I don’t remember lessons discussing the g there. I have also seen i or gi. Can someone explain? Thanks