g.copy: get rid of function in the loop.

This fixes a JSLint warning.