Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const people = Array.from(document.querySelectorAll('.people p'));
- const names = peopleArray.map(person => person.textContent);
- // ---------------------------------------------------------------
- const names = Array.from(document.querySelectorAll('.people p'), person => {
- return person.textContent
- });
- const ages = Array.of(1, 2, 3, 4, 5); // [1, 2, 3, 4, 5]
- // ---------------------------------------------------------------
- const code = 'VBgtGQcSf';
- const post = posts.find(post => post.code === code);
- const postIndex = posts.findIndex(post => post.code === code);
- console.log(postIndex);
- // ---------------------------------------------------------------
- const ages = [32, 15, 19, 12];
- // 👵👨 is there at least one adult in the group?
- const adultPresent = ages.some(age => age >= 18);
- console.log(adultPresent); // true
- // 🍻 is everyone old enough to drink?
- const allOldEnough = ages.every(age => age >= 19);
- console.log(allOldEnough); // false
Add Comment
Please, Sign In to add comment