Test name | Executions per second |
---|---|
simple | 2874174.2 Ops/sec |
locale | 1091011.0 Ops/sec |
<div id="container"></div>
var container = document.getElementById("container");
var string1 = "lorem ipsum dolor sit amet bla bla some more text let's go we in it to win it";
var string2 = "lorem ipsum dolor sit amet bla bla some more text let's go we in it to win it you've changed man why though?"
container.textContent = "lorem ipsum dolor sit amet bla bla some more text let's go we in it to win it";
if (string1 !== string2) {
container.textContent = string2;
}
if (string1.localeCompare(string2)) {
container.textContent = string2;
}