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

269
Vistas
How to call multiple functions in javascript and have them display?

I'm trying to call multiple functions at once and have them displayed on the screen. CalculateSum function is able to display correctly. The error message is quotient not defined. I've looked at CalculateQuotient function, I don't understand what I'm missing. Is there a different way to call the function?

function CalculateSum(numberOne,numberTwo) {
  var sum = 0;
  sum = (numberOne + numberTwo);
  return sum
}

function CalculateDifference(numberOne,numberTwo) {
  var difference = 0;
  difference = (numberOne - numberTwo);
  return difference
}
function CalculateProduct(numberOne,numberTwo) {
  var product = 0;
  product = (numberOne * numberTwo);
  return product
}
function CalculateQuotient(numberOne,numberTwo) {
  var qoutient = 0;
  quotient = (numberOne / numberTwo);
  return quotient

}

function Main() {
// variables for this part of the program
  var numberOne = 0;
  var numberTwo = 0;
  var output = "";
  
 
// get value from users  
  numberOne = prompt("Enter first nummber");
  numberTwo = prompt("Enter second number");
 
  numberOne = Number(numberOne);
  numberTwo = Number(numberTwo);
  

// call function and capture return value
  sum = CalculateSum(numberOne, numberTwo);
  difference = CalculateDifference(numberOne, numberTwo);
  product = CalculateProduct(numberOne, numberTwo);
  quotient = CalculateQuotient(numberOne, numberTwo);
  
// create output statement
  output = "The sum is " + sum + ".";
  output = "The difference is " + difference + ".";
  output = "The product is " + product + ".";
  output = "The qoutient is " + qoutient + ".";

  document.write(output);
}

// We have to call our Main function explicitly or it won't work.
Main();

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

quotient is misspelled as qoutient when you concatenate your output string together. So the interpreter is attempting to evaluate a variable that hasn't actually been defined

about 4 years ago · Juan Pablo Isaza Denunciar

0

The variable name is "quotient" and not this "qoutient" just change that.

Thanks

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