added toArray()

added toArray() function
passes JSHint