I have following data,
const array1 = [{id:1,name:'john'},{id:2,name:'peter'}];
const userObject={};
and I am forming new array of object like ,
const newarray =[...array1, userObject];
My requirement is ,if userObject is empty {},then i dont want to pass it in new array like,
const newarray =[...array1];
else
const newarray =[...array1, userObject];