Problem LED blink sequence with different "ON & OFF" interval use millis

Hi everyone, I'm trying to make LED blink sequence with different "ON & OFF" interval, I use delay() on my sketch and it's work, here is the sketch:

int timerON = 500;           // The higher the number, the slower the timing.
int timerOFF = 200;
int ledPins[] = { 
  2, 7, 4, 6, 5, 3 };       // an array of pin numbers to which LEDs are attached
int pinCount = 6;           // the number of pins (i.e. the length of the array)

void setup() {
  // the array elements are numbered from 0 to (pinCount - 1).
  // use a for loop to initialize each pin as an output:
  for (int thisPin = 0; thisPin < pinCount; thisPin++)  {
    pinMode(ledPins[thisPin], OUTPUT);      
  }
}

void loop() {
  // loop from the lowest pin to the highest:
  for (int thisPin = 0; thisPin < pinCount; thisPin++) { 
    // turn the pin on:
    digitalWrite(ledPins[thisPin], HIGH);   
    delay(timerON);                  
    // turn the pin off:
    digitalWrite(ledPins[thisPin], LOW);    
    delay(timerOFF);
  }
}

and I try to replace delay() with millis but I get a randomize LED blink, here is the sketch:

int ledPins[] = { 
  5, 6, 7, 8, 9, 10, 11, 12};       // an array of pin numbers to which LEDs are attached
int pinCount = 8;           // the number of pins (i.e. the length of the array)

long previousMillis = 0; 
long interval1 = 500;
long interval2 = 1000; 

void setup() {
  // the array elements are numbered from 0 to (pinCount - 1).
  // use a for loop to initialize each pin as an output:
  for (int thisPin = 0; thisPin < pinCount; thisPin++)  {
    pinMode(ledPins[thisPin], OUTPUT);      
  }
}

void loop() {
  // loop from the lowest pin to the highest:
  
  for (int thisPin = 0; thisPin < pinCount; thisPin++) { 
    unsigned long currentMillis = millis();
    if(currentMillis - previousMillis > interval1) {
      digitalWrite(ledPins[thisPin], LOW);
    }   
    if(currentMillis - previousMillis > interval2) {
      digitalWrite(ledPins[thisPin], HIGH);
      previousMillis = currentMillis;   
    }
  }
}

What's wrong with my sketch?

Suggest you put this at the top of loop()
unsigned long currentMillis = millis();

long previousMillis = 0;
Should be:
unsigned long previousMillis = 0;

Exactly what do you want the outcome to be?

.

The outcome that I want is like my first skecth (using delay()). I try to replace delay to millis.

Your new sketch will switch on all LEDs and switch off all LEDs together. Your old sketch switched them on and off again in sequence.

To match your old sketch, you must get rid of the for() loop and replace it with a variable which will not lose its value each time loop() ends. When it is time to switch led on, and only at that time, you need to change this variable, updating it to the next led number in sequence.