Hi everyone,
Could someone help me understand the code down below. I'm using a Conditional (ternary) operator that I got from this tutorial but having trouble understanding.
I believe I have a grasp of majority of it, but what I don't understand is what the
Could someone help me understand the code down below. I'm using a Conditional (ternary) operator that I got from this tutorial but having trouble understanding.
JavaScript:
index = index >= colors.length - 1 ? 0 : index + 1;
I believe I have a grasp of majority of it, but what I don't understand is what the
-1
is doing?