Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const $attendees = Array.from(document.querySelectorAll('h4.text--ellipsisOneLine'));
- function firstNames(t) {
- var x = t.split(' ');
- if (x.length === 1) {
- console.warn(`Invalid name: ${t}`);
- }
- if (x.length == 2) {
- return x[0];
- }
- if (x.length === 3 || x.length === 4) {
- return `${x[0]} ${x[1]}`;
- }
- if (x.length > 4) {
- console.log(`wow it is a long name: ${t}`);
- }
- }
- $attendees.map(i => i.innerText).map(firstNames).join('\n')
- function lastNames(t) {
- var x = t.split(' ');
- if (x.length === 1) {
- console.warn(`Invalid name: ${t}`);
- }
- if (x.length == 2) {
- return x[1];
- }
- if (x.length === 3) {
- return x[2];
- }
- if (x.length === 4) {
- return `${x[2]} ${x[3]}`;
- }
- if (x.length > 4) {
- console.log(`wow it is a long name: ${t}`);
- }
- }
- $attendees.map(i => i.innerText).map(lastNames).join('\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement