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

460
Visualizações
JS - Why can't the Chrome console access my global variable?

I have the following variable declared at the top level of the script:

var region = “southwest”;

When running

console.log(region)

I'm getting the following error:

VM1094:1 Uncaught ReferenceError: region is not defined at :1:13

Not sure what is causing this given the variable is global.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

when you have global variables they will be assigned to window object , in your console try console.log(window.region)

about 4 years ago · Juan Pablo Isaza Relatório

0

Is "southwest" a string or a variable that you have assigned to the 'region' variable? If it's a string, you need to put it inside the "double quotes". And, if it is a variable, then you need to assign some value to it.

about 4 years ago · Juan Pablo Isaza Relatório
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