mardi 30 avril 2019

How do I put a local-storage item in an if statement?

I'm working on some code that runs a function when it detect the local storage item 'En' is equal to the string "English". Is there any way I could put 'En' = "English" inside the rules for an if statement? My current code:

const En = "English"

document.getElementById("langEn").onclick = function() {remLangEn()};

function remLangEn() {
localStorage.setItem(lang, En);
}

Aucun commentaire:

Enregistrer un commentaire