Js Push Array Error Handling In Javascript