Here is my code:
bot.on('message', async message => {
  function httpGet(url, callback) {
    // this function gets the contents of the URL. Once the
    // content is present it runs the callback function.
    var xmlhttp=new XMLHttpRequest();
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4 && xmlhttp.status==200) {
            callback(xmlhttp.responseText);
        }
    }
    xmlhttp.open("GET", url, false );
    xmlhttp.send();    
}
httpGet("http://www.bannedwordlist.com/lists/swearWords.txt", function(textFile){
    // this calls the httpGet function with the URL of your text
    // file. It then runs a function that turns the file into an
    // array.
    let blacklisted = textFile.slice(1, -1).split("],[");
});
  //2 looking for words
  let foundInText = false;
  for (var i in blacklisted) { // loops through the blacklisted list
    if (message.content.toLowerCase().includes(blacklisted[i].toLowerCase())) foundInText = true;
  }
  // checks casesensitive words
  //3 deletes and send message
    if (foundInText) {
      message.delete();
      message.channel.sendMessage("Hey! Please don't use bad words on our server!")
  }
});
Node gives the error 'blacklisted is not defined', when I define it in the code (let blacklisted =... etc.)
If I defined it, why is it saying it isn't.
 
     
     
    