Created
May 12, 2017 07:14
-
-
Save yuan3y/c62556ac0fdabc3bab64869d4366588b to your computer and use it in GitHub Desktop.
find blood stock level in Singapore bloodbank https://www.redcross.sg/
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
/*jQuery way*/ | |
Array.from([["last_update",jQuery('.last_update').text().slice(25)]].append(jQuery('div.human').map((a,b)=>{return [[jQuery(b).children('.blank_humam').text(), jQuery(b).children('.fill_humam').prop('style').height]];}))).reduce((p,c,i)=>{p[c[0]]=c[1]; return p;},{}) | |
/*VanillaJS functional equivalence*/ | |
Array.from([["last_update",document.querySelector('.last_update').innerText.slice(25)]].append(Array.from(document.querySelectorAll('div.human')).map((b)=>{return [b.children[0].innerText, b.children[1].style.height];}))).reduce((p,c,i)=>{p[c[0]]=c[1]; return p;},{}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment