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

279
Vistas
Storing the value of a variable after using a funcition

So I don't know if this can be done or not but I'm have this function and with some of the variables that I get the result from I make other operations, here is the code.

x();
function x() {
  if (y === "yes") {
    var a = parseInt(prompt("Insert Number Here"))
    var b = parseInt(prompt("Insert Number Here"))
    var c = a * b
    var cont = prompt("yes or no").toLowerCase();
    if (cont === "yes") {
      x();
    } else if (cont === "total") {
      alert total();
    }
  } else if (z === "yes") {
    var d = parseInt(prompt("Insert Number Here"))
    var e = parseInt(prompt("Insert Number Here"))
    var f = d * e
    var cont = prompt("yes or no").toLowerCase();
    if (cont === "yes") {
      x();
    } else if (cont === "total") {
      alert total();
    }
  }
function total() {
  c = c|| 0;
  f = f|| 0;
  return `The total is $${c + f}`
}
}

So, when I run this it just gives the result of the last operation made

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