Guest User

Untitled

a guest
May 22nd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. const people = Array.from(document.querySelectorAll('.people p'));
  2.  
  3. const names = peopleArray.map(person => person.textContent);
  4.  
  5. // ---------------------------------------------------------------
  6.  
  7. const names = Array.from(document.querySelectorAll('.people p'), person => {
  8. return person.textContent
  9. });
  10.  
  11. const ages = Array.of(1, 2, 3, 4, 5); // [1, 2, 3, 4, 5]
  12.  
  13. // ---------------------------------------------------------------
  14.  
  15. const code = 'VBgtGQcSf';
  16. const post = posts.find(post => post.code === code);
  17.  
  18. const postIndex = posts.findIndex(post => post.code === code);
  19. console.log(postIndex);
  20.  
  21. // ---------------------------------------------------------------
  22.  
  23. const ages = [32, 15, 19, 12];
  24.  
  25. // 👵👨 is there at least one adult in the group?
  26. const adultPresent = ages.some(age => age >= 18);
  27. console.log(adultPresent); // true
  28.  
  29. // 🍻 is everyone old enough to drink?
  30. const allOldEnough = ages.every(age => age >= 19);
  31. console.log(allOldEnough); // false
Add Comment
Please, Sign In to add comment