samedi 25 février 2017

Comparing using a percentage sign? % JavaScript

When simplifying my code, a stack overflow user changed this line of code:

if (place > sequence.length -1) {
    place = 0;

to this:

 place = place % sequence.length;

and I'm wondering what this line actually does and how you would define the use of this line and the use of the percentage sign. Thanks for help in advance.

Aucun commentaire:

Enregistrer un commentaire