Find a javascript fix pattern

If I have many javascript files, one of which has code with an error and the other without, how can I find the difference between them in order to find a pattern of fixing for all of them?
For example, if I have this source code: 
var x = whatever;
if (x === Nan) {//} eslint will throuth an error saing use-isnan so to fix it, I have the target code: 
var x = whatever;
if (isNan(x)) {}