replace
returns the new string, it doesn't modify the original.
Try html.className = 'js'
, since you've already established that it's the only class name with your if
statement.
EDIT: Also, the <html>
tag is already available as document.documentElement
.
document.documentElement.className = 'js';
That's all you need, really. No if
statement, no variable, nothing.