I want to compare two lines in JavaScript to check if they are the same. What would be the best (fastest) way to do this?
Right now, I'm considering either
if(string1.localeCompare(string2) == 0) {}
or simply
if(string1 == string2)
Is there a better way to do this?
javascript string-matching
atreju
source share