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

180
Visualizações
Why is my variable "status" showing up deprecated in my code?

Why is my variable status showing up deprecated in my code? How do you fix this? Sorry, I'm fairly knew to JavaScript.

var age = prompt("what is your age?");

if (age >= 18 && age <= 35) {
  status = "target demo";
  console.log(status);
} else {
  status = "not my audience";
  console.log(status);
}

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

0

The problem arises because you are trying to use the status variable without defining it, as @epascarello pointed out; If you use the status variable without defining it, you are overwriting the Window.status[1] property, but you do not get the warning that the status variable is not defined.

As @maksymiuk stated, if you use the status variable by defining it yourself, you will write it to the status variable that you do not recognize, not the Window.status property.

var age = prompt("what is your age?");
let status;

if (age >= 18 && age <= 35) {
  status= "target demo";
  console.log(status);
} else {
  status= "not my audience";
  console.log(status);
}


1 - Window.status

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