Created
October 27, 2018 17:11
-
-
Save spig/ecf49a16e5535800225aaa7727c979aa to your computer and use it in GitHub Desktop.
Process a table row to get some text information from it
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
function processRow(row) { | |
let items = [... row.getElementsByTagName("td")] | |
let elementName = items[2].innerText | |
let elementSymbol = items[1].innerText | |
let atomicNumber = items[0].innerText | |
return elementName + ", " + elementSymbol + ", " + atomicNumber | |
} | |
var elements = [... document.getElementsByTagName("tr")].splice(1,).map(processRow).join('<br/>\n') | |
document.write(elements) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment