My aim is to compare the first line of a text file to input recieved from a form. My code successfully reads from the file,after that I use the following code
var lines=result.split("\n"); //this line turns file into array
var line=lines[i].split(" "); //each index is further changed into an array
var sentence=lines[i].split(" ").join(" ").toLowerCase(); //this turns the line/sentence from an array into a String
var input=document.getElementById('inputFromForm').value.toLowerCase(); //this line get input from form
console.log(sentence); //this prints the first line of the text file to the console
console.log(input); //this prints the inputFromForm to the text file
console.log(sentence==input); //check for equality
My problem is that both sentences are equal but the console says false to
console.log(sentence==input);
How is that possible,and why.