ConfirmIt Match the precodes of two questions

Make a mask that checks if the provided answers in an array format are marked in the previous question. This is very useful when the answers in both questions are the same but their precodes are different.

//surveyscripting.com

//usage: MatchPrecodes('Q1', new Array('1', '2'), new Array('1', '5'));
//match the precodes from the both questions

function MatchPrecodes(qid, fmatch, smatch) 
{
  var s = new Set();
  var g = f(qid);
  var d = g.domainValues();
  for ( var i : int = 0; i < fmatch.length; ++i )
  {
    if ( g[fmatch[i]].toBoolean() )
    {
      s.add[smatch[i]];
    }
  }
  return s;
}