问题描述:

I'm writting to you for a question that I have since a few days ago.

Obviously everybody knows what this piece of code does, right?

let count = 10;

let clock = setInterval(function(){

count--;

if(count === 0) clearInterval(clock);

}, 1000);

Well, my question is the following since I discovered that eval() can lead to DOM XSS Vulnerabilities.

How I possibly avoid using this kind of eval() functions since I need them to display too many timers (DateTime Countdowns) at my web application.

I was thinking about some sort of recursive functionality to achieve this goal. What do you guys think?

Thanks for your answers!

相关阅读:
Top