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

143
Vistas
Whenever my code runs it just comes up as "javascript"
<!DOCTYPE html>

<html>

<head>

<style>




</style>

</head>

<body>

<script>
//variables//
var x = Math.floor((Math.random() * 5) + 1);
var y;

//variable y//
if (x = 1) {
    y = 'javascript';
} else if (x = 2) {
    y = 'html';
} else if (x = 3) {
    y = 'python';
} else if (x = 4) {
    y = 'swedish';
} else if (x = 5) {
    y = 'your choice';
} else {
    y = 'error';
} 
//what should be printed//
document.write('<h3>' + y + '</h3>');
</script>

</body>

I'm trying to make some javascript code that decides what I am going to focus on for the day but it just comes up as "javascript" whenever I try to load it. I could have a bit of code in the wrong or some invalid syntax, I'm not entirely sure what could be wrong because I'm pretty new to javascript.

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