Vienzz

Check Array If Same or Not - in jquery

Jan 8th, 2021
1,419
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. success: function(data) {
  2.     var myObj = [];
  3.     for ( var i = 0; i < data.length; i++ ) {
  4.         myObj.push(data[i]['status']);
  5.     }
  6.     var join = myObj.join(",").split(',').map(Number);
  7.  
  8.     var eq = join.every( (val, i, arr) => val === 0 );
  9.     if (eq == true) {
  10.         console.log("tidak ada notif");
  11.     } else {
  12.         $.each(data, function(key, value) {
  13.             if (value.status == 1) {
  14.                 console.log(value.nama);
  15.             }
  16.         });
  17.     }
  18. }
RAW Paste Data