0

I have this structure

function foo() {
    var obj = [];
    var text = '...';
    text = text.replace(/.../g,matching_fn);
}

function matching_fn($match, $match1, $match2) {
    // i need obj here
}

I tried matching_fn use (obj) in the replace, but that didnt work.

How can I pass additional variables into my matching_fn?

rhavin
  • 1,512
  • 1
  • 12
  • 33

0 Answers0