Js countdown array problem

Hello,

I’m having an issue in a project…

I have a 1 round inside an array like a = [5, 12, 6]; when i increment a new round it will a.push(12, 6);

So far so good … BUT it will countdown only the 3 first array positions.

Any ideas ??

Thanks a lot guys

The js file is :

Http://inkroyable.ch/time2roll/dois.html

http://inkroyable.ch/time2roll/js/functions.js

Without digging through your html and css, I can’t really test this, but I do notice the lines:

var a = [5, 12, 6];
var index = a.length;

at the top.

So, index is going to be 3. When you later do a.push(12, 6);, index will still be 3 - it doesn’t automatically update. I would get rid of the variable index and just use a.length wherever you need it. I don’t know if that is causing your problem, but it looks like it could easily. If you provide the raw html and css, we can try it locally and we can take a deeper dive.

1 Like

Thanks :slight_smile: it has helped me a lot :kissing_closed_eyes:

Now working … :star_struck:

1 Like