Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. const $attendees = Array.from(document.querySelectorAll('h4.text--ellipsisOneLine'));
  2.  
  3. function firstNames(t) {
  4. var x = t.split(' ');
  5. if (x.length === 1) {
  6. console.warn(`Invalid name: ${t}`);
  7. }
  8. if (x.length == 2) {
  9. return x[0];
  10. }
  11. if (x.length === 3 || x.length === 4) {
  12. return `${x[0]} ${x[1]}`;
  13. }
  14. if (x.length > 4) {
  15. console.log(`wow it is a long name: ${t}`);
  16. }
  17. }
  18.  
  19. $attendees.map(i => i.innerText).map(firstNames).join('\n')
  20.  
  21. function lastNames(t) {
  22. var x = t.split(' ');
  23. if (x.length === 1) {
  24. console.warn(`Invalid name: ${t}`);
  25. }
  26. if (x.length == 2) {
  27. return x[1];
  28. }
  29. if (x.length === 3) {
  30. return x[2];
  31. }
  32. if (x.length === 4) {
  33. return `${x[2]} ${x[3]}`;
  34. }
  35. if (x.length > 4) {
  36. console.log(`wow it is a long name: ${t}`);
  37. }
  38. }
  39.  
  40. $attendees.map(i => i.innerText).map(lastNames).join('\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement