<div style='font-size: 22px;' id='container'></div>
<!-- esto no funciona por qeu en jsfiddle no funciona bien las window.variable y por eso pero si lo corres por ejemplo en tu navegador en tu pagin avas a ver qeu funciona chulada y aqui si tienes qeu esperar hasta que termine no puedes hacer window.Value=true desde consola por qeu no lo toma en cuenta-->
JavaScript
jQuery(function(){
var n = 100;
var val = 'test_params';
setTimeout(function(){countDown(val)}, 1000);
function countDown(val){
n--;
console.log(val);
if(window.Value) {
n = 0;
console.log('execute this finally');
}
if(n > 0){
setTimeout(function(){countDown(val)}, 2000);
}
jQuery('#container').html(n);
}
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.