Create Two Sub Array From Method In Javascript