Check if a string has 20 numbers in a row in it
If you use a regular expression to look for 20 digit characters (\d) in a row, then the code would be compact and the goal would be visible at a glance:

var twentyDigits = /\d{20}/;
if (twentyDigits.test(myString)){
  console.log("My string has 20 running numbers");
}


You can shorten this further as just:

if (/\d{20}/.test(myString)) console.log("Yup. 20");