Sha256: 388d232dfa056ffc80ce27a2459d7728452b12d9cfebf99498892df0c089d890
Contents?: true
Size: 747 Bytes
Versions: 9
Compression:
Stored size: 747 Bytes
Contents
// THIS IS A TEST const PARENT = document.getElementById('Data'); function createParagraph(i) { function counter(i) { const p = document.createElement('p'); p.innerHTML = ` A new paragraph has been created and added to the DOM. count = ${i}`; PARENT.insertAdjacentElement('beforeend', p); } counter(i); } const once = (function (i) { let executed = false; return function (i) { if (!executed) { executed = true; createParagraph(i); } }; })(); function runForLoop(arg) { const arr = [1, 1, 1, 1, 1]; for (let i = 1, len = arr.length; i < len; i++) { arg == 'once' ? once(i) : createParagraph(i); } } function test() { // Code to test here runForLoop(); } export default test;
Version data entries
9 entries across 9 versions & 1 rubygems