A piece of Javascript code is as follows:
num=\"11222333\";
re = /(\\d+)(\\d{3})/;
re.test(num);
num.replace(re, \"$1,$2\");
<
You are misinterpreting that line of code. You should consider the string "$1,$2" a format specifier that is used internally by the replace function to know what to do. It uses the previously tested regular expression, which yielded 2 results (two parenthesized blocks), and reformats the results. $1 refers to the first match, $2 to the second one. The expected contents of the num string is thus 11222,333 after this bit of code.