Math.wrap doesn't alter the arguments, it just returns a wrapped value.
Math.wrap
As such Math.wrap(k++, 10); won't do anything - you'd probably want k=Math.wrap(k+1, 10);
Math.wrap(k++, 10);
k=Math.wrap(k+1, 10);
But as @MaBe says, for this kind of thing with just integers you could also easily use modulo: k=(k+1)%10;
k=(k+1)%10;
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Math.wrap
doesn't alter the arguments, it just returns a wrapped value.As such
Math.wrap(k++, 10);
won't do anything - you'd probably wantk=Math.wrap(k+1, 10);
But as @MaBe says, for this kind of thing with just integers you could also easily use modulo:
k=(k+1)%10;