Javascript If Array Is Not Empty In Js Object Methods In Js