js change html lang

JavaScript
document.documentElement.lang = lang;
Source

Also in JavaScript: