JScript array refactor