simplified conversion to array routine and added compatibility to pre-harmony javascript