I want to wrap around I try
const lastIndex = showroom.cars.length - 1;
if(index < 0){
index = lastIndex;
}
if(index > lastIndex){
index = 0;
}
showroom.showOne(index);
but the index is decreasing to -1 or increasing above 4 so 5
the car changes from first to last and from last to first
for example when I change from first, so go left
the car is last but the index is -1
ok %
?
index = x % cars.length;