Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

243
Visualizações
JsException: TypeError: Undefined and null dont have properties

I searched everywhere to find the solution, but I find none of them are relevant to mine.

I tried to store a variable in local storage, but I'm getting the below error:

raise MakeError('TypeError',
JsException: TypeError: Undefined and null dont have properties (tried getting property 'setItem')

So I checked whether it is running on browser,

if (typeof window !== 'undefined') {
    console.log('You are on the browser')
    if(message1!='undefined'){
        console.log("message1 is not undefined")
        window.localStorage.setItem("vOneLocalStorage",message1);
    }
    
  }

Before giving the error, it printed "You are in the browser" in console, which I gave in the code to test

output in console before giving the error

I don't understand what is the cause, and why is it not able to store the variable in the local storage.

The tech stack I use are Javascript, React, python, and Js2py library to pass input from Python to Javascript.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda