Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

174
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda