Why won't this read my file!? What am I missing
NOTE - I also get warning : XMLHttpRequest on the main thread is deprecated because - not sure what else to use?
<script>
function readTextFile(file)
       {
           var rawFile = new XMLHttpRequest();
           rawFile.open("GET", file, true);
           rawFile.onload= function (){
               if(rawFile.readyState === 4)
               {
                   if(rawFile.status === 200 || rawFile.status == 0)
                   {
                       var allText = rawFile.responseText;alert(allText);
                       console.log(alltext);
                   }    
                }
           }
        }
        var test = readTextFile("file:///C:/Users/.../Desktop/***.txt")
        console.log("test"+ test); //undefined
</script> 
     
    