TestDome Decorate
by ronnjoe
JavaScript
function appendChildren(decorateDivFunction) {
var allDivs = document.getElementsByTagName("div");
console.log(allDivs.length);
var abc = allDivs.length;
for (var i = 0; i < abc; i++) {
console.log(allDivs.length);
var newDiv = document.createElement("div");
//decorateDivFunction(newDiv);
allDivs[i].appendChild(newDiv);
}
}
// Example case.
document.body.innerHTML = `
<div id="a">
<div id="b">
</div>
</div>`;
appendChildren();
console.log(document.body.innerHTML);