Created
July 11, 2019 09:45
-
-
Save skttl/f755d7d5e4111b7ebaa7cb7b960818a2 to your computer and use it in GitHub Desktop.
IKEA huskeliste til js object
This file contains hidden or 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
console.table([...products].map(p => { | |
var o = {}; | |
o.name = p.querySelector(".product__name").innerText; | |
o.description = [...p.querySelectorAll(".product__description-list > :not(:last-child)")].map(d => d.innerText).join(" "); | |
o.articlenumber = p.querySelector(".product_description-article-number").innerText; | |
o.price = (p.querySelector(".product__price-regular") || p.querySelector(".product__total")).innerText; | |
o.quantity = p.querySelector(".product-controls__quantity select").value; | |
o.total = p.querySelector(".product__total").innerText; | |
return o; | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment