title: Javascript-Edge browser- TypeError: Function expected
body: <p>This code will show an error: <code>TypeError: Function expected</code></p>
  
  <pre><code>function btnUploadImageEvent() {
      $(document).on("click", "#btn-upload-image", function () {
  
          // Iterate all td's in second column
          $("#table-image tbody tr:not(:first-child)").each(function (index, value) {
              var blob = value.cells[5].innerText;
              var fileName = (index + 1) + ".jpg";
  
              srcToFile(blob, fileName, "image/jpeg")
                  .then(function (file) {
                      var formData = new FormData();
                      formData.append("file", file);
  
                      PassingBlobToServer(formData);
                  }, function (error) {
                      MsgBox("Error", error, "error", "#upload-image-modal");
                  }).then(function () {
                  });
          });
      });
  }
  
  function srcToFile(src, fileName, mimeType) {
      return (fetch(src)
          .then(function (res) { return res.arrayBuffer(); })
          .then(function (buf) { return new File([buf], fileName, { type: mimeType }); })
      );
  }
  </code></pre>
  
  <p>I read this article already: <a href="https://docs.microsoft.com/en-us/scripting/javascript/misc/function-expected" rel="noreferrer">https://docs.microsoft.com/en-us/scripting/javascript/misc/function-expected</a></p>
  
  <p>However, I'm still not understanding what MS say.
  This must be something wrong in my code.
  Please help me, thanks a lot.</p>