workaround a BB10 JavaScript VM bug by doing forEach differently