Universal string comparison in JavaScript

If it’s more important than that between the lines, put the lines away.

String comparison in JavaScript if(“text string”==”text string”) will not return true because In fact, not the strings are compared, but the addresses of those strings in memory. To compare a string, you can wrap it like this: new String(“text string”).valueOf().

if(new String("text string").valueOf() == new String("text string").valueOf()){
		console.log('eq');
}