juliarnasution

ini soal dari sesama anggota clan nasution

Jan 23rd, 2020
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (async function (){
  2.         let data = await fetch('https://mul14.github.io/data/employees.json').then(result=>result.json()).then(result=> result);
  3.     let gaji = data.filter(item=>{
  4.         return (item.salary>1500000) ? true : false;
  5.      })
  6.      console.log('gaji',gaji);
  7.      
  8.       let domisili =  data.filter(item=>{
  9.             return (item.addresses[0].city==="DKI Jakarta") ? true : false;})
  10.       console.log('domisili',domisili);
  11.      
  12.       let date =  data.filter(item=>{
  13.             let birth =new Date(item.birthday.split('-')).getMonth();
  14.             return (birth===2)? true:false;
  15.       })
  16.       console.log('ultah ',date);
  17.      
  18.       let department =  data.filter(item=>{
  19.             return (item.department.name=="Research and development")? true:false;
  20.       })
  21.       console.log('department ',department);
  22.      
  23.       let kehadiran =  data.map(item=>{
  24.         let kerja = item.presence_list.filter(list=>{
  25.           let harikerja =new Date(list.split('-')).getMonth();
  26.               return (harikerja===9) ? true: false;
  27.         });//end filter
  28.         let tidak_hadir = 31 - kerja.length;//anggaplah tiap minggu server rusak
  29.         return {...item,bolos :tidak_hadir};
  30.        });
  31.       console.log('kehadiran',kehadiran);
  32. }
  33. )()
Advertisement
Add Comment
Please, Sign In to add comment