Using the following code I call a function ("firstFunction") that generates an Array and returns the array.
async function doProcess() {
  const checkState = await firstFunction();
  console.log(checkState);
  console.log(checkState.length);
  return checkState;
}
Using console.log(checkState); I am able to print the data from the whole Array to the console.
When I try to access the values or array data, for example, console.log(checkState.length);, I get 0. What am I doing wrong here?
Edit [added "firstFunction"]:
 function firstFunction() {
            var array = [];
            var url3 = "/Home/CheckPrintService?printer=" + document.getElementById("printerName").value;
            $.get(url3, null, function (data3) {
                $("#msgPrinterName").html(data3);
                var str = $("#msgPrinterName")[0].innerText.toString();
                if (str.includes("ERROR CODE")) {
                    array.push(str);
                }
                //console.log($("#msgPrinterName")[0].innerText.toString());
            });
            var e = document.getElementById("ddlViewBy");
            var deviceType = e.options[e.selectedIndex].text;
            var url2 = "/Home/CheckIfValidIP?input=" + document.getElementById("ipAddress").value + "&type=" + deviceType;
            $.get(url2, null, function (data2) {
                $("#msgIPPort").html(data2);
                var str = $("#msgIPPort")[0].innerText.toString();
                if (str.includes("ERROR CODE")) {
                    array.push(str);
                }
            });
            var url = "/Home/CheckPrinter?printer=" + document.getElementById("printerName").value;
            $.get(url, null, function (data) {
                $("#msgPrintService").html(data);
                var str = $("#msgPrintService")[0].innerText.toString();
                if (str.includes("ERROR CODE")) {
                    array.push(str);
                }
            });
            return array;
        }

