PWM should be applied to ENA or IN1/IN2 for L298N board for speed control I am new to the Arduino stuff and I am using L298N to drive two DC motors. When I searched online for sample code, I noticed that there are two types of design. 

One type uses analogWrite(pin, pwmOutput) to control PWM on IN1/IN2 pin to adjust speed, and the other uses digitalWrite(pin, HIGH/LOW) to control IN1/IN2 but use analogWrite(enA, pwmOutput) to control speed. 

I guess probably both can work, but I just feel it is not right to apply PWM on the enable pin. Any suggestion from the experts?

One more thing, many people say L298N is obsolete. Would anyone please recommend a replacement motor drive module?
I'd use PWM on EN input. Motor will be driven in HIGH and left floating in LOW. The other method means it'll be shorted (= full on brake).

L298N is based on bipolar transistors. That means relatively big voltage drop between drivers Emitter and Collector (about 2V on each transistor), so there are big power losses (= heat).

Maybe something like LMD18200 could be used as unipolar replacement.