How many numbers are extracted from a string of numbers?

node js, give a string composed of numbers, for example, "8910151821", how to get the number of numbers between 3 and 20 in this string, the result should be: 8, 9, 10, 10, 15, 18, a total of 5 numbers, 21 of which does not count, how can it be realized? Thank you

Sep.16,2021

let compare = (d) => {
    return d > 3 && d < 20
}

'8910151821'.split('').map((d, i, arr) => {
    d = +d;
    if (i > 1) {
        let comD = arr[i - 1] * 10 + d;
        return compare(comD) ? comD : null
    } else if (compare(d)) {
        return d;
    }
}).filter(d => d);

const countNum = s => [...s].reduce((res, val) => {
  switch (true) {
    case !+val && res[2]:
      console.log('2' + val)
      res[0]PP
      res[2] = false
      break
    case +val > 2 && !res[1]:
      console.log(val)
      res[0]PP
      break
    case +val && +val < 3 && !res[1]:
      res[val] = true
      break
    case res[1]:
      console.log('1' + val)
      res[0]PP
      res[1] = false
      break
    default:
      [res[1], res[2]] = [false, false]
      break
  }
  return res
}, [0, false, false])[0]

countNum('8910151821')

is that what it means?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36a21-2c047.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36a21-2c047.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?