Created
June 1, 2019 08:34
-
-
Save jaamaalxyz/3e095812dbb8c54285077e6dc45ec826 to your computer and use it in GitHub Desktop.
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
function extractData() { | |
const boxes = Array.from(document.querySelector('#boxes').children); | |
const result = boxes.map(box => { | |
const obj = { | |
title: '', | |
subtitle: '' | |
} | |
for(let item of Array.from(box.children)) { | |
if(item.className === 'title') { | |
obj.title = item.textContent; | |
} | |
if(item.className === 'subtitle') { | |
obj.subtitle = item.textContent; | |
} | |
} | |
return obj; | |
}); | |
return result; | |
} | |
extractData() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment