Javascript Push Into Array If Else Javascript Ternary Function