👋 Hello! I'm Alphonsio the robot. Ask me a question, I'll try to answer.

extract js language

Hum ... I assume you want to get the page language.

In JavaScript, the best way to get the document language is to use:

document.documentElement.lang;


Another option is to retrieve the <html> tag lang attribute:

document.getElementsByTagName("html")[0].getAttribute("lang");

More