JSFiddle - React, Tailwind, and code Playground

JavaScript

var sTest = "g66ghy7";

var iCount = 0;
for (iIndex in sTest) {
    if (!isNaN(parseInt(sTest[iIndex]))) {
        iCount++;
    }
}
alert(iCount);