Posts

Showing posts from December, 2021

arrays

  // remove same data from two arrays const array1 = this . Productsforcompare ; const array2 = this . Productsnewcompare2 ; const array3 = array1 . filter ( entry1 => ! array2 . some ( entry2 => entry1 . ProductID === entry2 . ProductId )); console . log ( array3 ); / / end remove same data from two arrays // remove single id based remove data from array const items = JSON . parse ( localStorage . getItem ( 'outbounddatasavedlocal' )); const filtered = items . filter ( item => item . OutboundId !== this . removeouterid ); localStorage . setItem ( 'outbounddatasavedlocal' , JSON . stringify ( filtered ));

filter array object names

   const sortBy = fn => {           const cmp = (a, b) => -(a < b) || +(a > b);           return (a, b) => cmp(fn(a), fn(b));         };                const CategoryName = o => o.CategoryName;         const CategoryName1 = sortBy(CategoryName);                 this.datapushnew3.sort(CategoryName1);         this.datapushnew4=this.datapushnew3;         console.log(this.datapushnew3.map(CategoryName));           console.log(this.datapushnew3 ,"this.datapushnew2.sort()");           }