<header><div>Header Text Content</div></header>
<script>
const content = {
parseContent: function(id) {
let txt = [];
document.querySelectorAll(id + ' div').forEach((div, i) => txt[i] = div.textContent);
return txt;
},
header: function () { return this.parseContent('header') },
main: function () { return this.parseContent('main') },
footer: function () { return this.parseContent('footer') }
}
alert(content.header());
</script>