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

268
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

0

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

Thanks

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