Last active
November 19, 2018 06:00
-
-
Save LukasPolak/77893899691176b7ce36d8fd9d4d25ad to your computer and use it in GitHub Desktop.
Copy Array/Object to your clipboard with browser built-in Developer Tools
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Go to the https://www.wearedevelopers.com/speakers/ website and open the web console | |
// 2. Declare a variable with an empty array. | |
// Don’t be afraid of undefined. It’s because all you are doing is declaring a variable. | |
let speakersArr = []; | |
// 3. Find every occurrence of speaker name, in this case, it is a `.team-meta h3`. | |
// Then every element that was found should be converted do `Array` (now it is a `NodeList`). | |
const speakersElements = Array.from(document.querySelectorAll('.team-meta h3')); | |
// 4. Map through every speaker and push the speaker `textContent` to | |
// `speakersArr` declared at the top of the page. | |
speakersElements.map(speaker => { | |
speakersArr.push(speaker.textContent); | |
}); | |
// 5. Copy the result to your clipboard | |
copy(speakersArr); | |
// 6. When you paste the code it should look like this: | |
// [“Steve Wozniak”, …, “Eric Steinberger”] | |
// 7. That’s it. Pretty simple right? Thanks for the reading. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment