optimization to javascript arrays conversion (issue #2279 )