Guest User

Untitled

a guest
Jan 17th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. let people = [{
  2. "id": 1,
  3. "firstName": "Frank",
  4. "lastName": "Herbert",
  5. "job": "Lead Software Engineer",
  6. "Skills": ["JavaScript", "C#", "SQL", "HTML", "CSS", "SCRUM
  7. Master"],
  8. "Salary": 120196
  9. },
  10. {
  11. "id": 2,
  12. "firstName": "Joan",
  13. "lastName": "Armorett",
  14. "job": "Jr Software Developer",
  15. "Skills": ["JavaScript", "HTML", "CSS"],
  16. "Salary": 70000
  17. }
  18.  
  19. // This is the .map function, which will show me all of the names,
  20. regardless of their salary.
  21. let answer = people.map((person) => {return person.firstName});
  22.  
  23. // This is the .filter function, which will show me all data, not
  24. just names on everyone with a salary of 100000 or higher.
  25. let answer = people.filter((person) => {
  26. return person.Salary > 100000;
  27. });
Add Comment
Please, Sign In to add comment