Advertisement
kalimjava

map,reduce and filter

Mar 23rd, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <head>
  5.     <meta charset="UTF-8">
  6.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7.     <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8.     <title>Document</title>
  9. </head>
  10.  
  11. <body>
  12.  
  13.  
  14.     <script>
  15.  
  16.         // return only the workers with salary greater than 1000 pounds
  17.         //from the array below
  18.  
  19.         var employee = [
  20.             { id: 10, name: "Paul Dameon", salary: 800, },
  21.             { id: 20, name: "Temmo Wex", salary: 2000, },
  22.             { id: 41, name: "Kalim Lintra", salary: 5000, },
  23.             { id: 99, name: "Akpova Asty", salary: 600, },
  24.             { id: 66, name: "Pahun Linto", salary: 5000, },
  25.             { id: 72, name: "Cynthia Ross", salary: 8000, }
  26.         ];
  27.  
  28.  
  29.         function employeeSalary(Object, keys) {
  30.  
  31.             var newEmployee = employee.filter((x) => x.salary > 1000);
  32.  
  33.             document.write(newEmployee);
  34.             console.log(newEmployee);    
  35.         }
  36.         employeeSalary();
  37.     </script>
  38. </body>
  39.  
  40. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement