Change Content - Javascript
Change html element content using pure javascript author(s): Deepu Mohan Puthrote (WarFox)
by RAKSHIT SHAH
HTML
<div id="myelement">Old Text</div>
JavaScript
var counter = 0;
(function recursiveFn(x) {
if (!x) {
return; //Stop execution
}
counter++;
console.log("counter : "+counter + " || x : "+ x)
recursiveFn(--x); // Recursive function call **********
// open console to see the output!
// it will execute function like...
//5
//4
//3
//2
//1
})(5);