Another option is not to try to create variables with dynamic names, but to use a map type for this.
Example:
var intervalos = [];
intervalos['a_103'] = setInterval(function(){ console.log('oi'); }, 3000);
...
clearInterval(intervalos['a_103']);
A more complete example, creating and cleaning several timers:
var intervalos = [];
//cria intervalos de a_1 até a_150
for (var i = 0; i < 150; i++) {
intervalos['a_' + (i+1)] = setInterval(
function(){ console.log('oi'); },
3000 + i * 100);
}
//depois
for (var i = 0; i < 150; i++) {
clearInterval(intervalos['a_' + (i+1)]);
}
//ou
clearInterval(intervalos['a_103']);
could have used
clearInterval(window[id])
if the scope is comprehensive– fernandosavio