mercredi 25 mai 2016

jQuery if sentence on variable odd number

What I am trying to achieve:
I have a function that I want to run every time my counter is 1, 3, 5 or 7. I am confused about what the right syntax is for jQuery in this situation and I was hoping someone could help me clear it up.

My try so far:

if (i == (0, 2, 4, 6)) {

This is one of the many versions that I have tried, and failed with.

Thanks
I would be very grateful if anyone could teach me the right syntax, both for every odd number, as well as a specific collection of numbers, for example '3, 12, 512, 2231'. Any help, tips or such will be very appreciated. Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire