Buscar

Consider the following JavaScript code: function calcular(x, y, z) { return x + y * z; } What is the result of calling the function with the a...

Consider the following JavaScript code:

function calcular(x, y, z) {
return x + y * z;
}

What is the result of calling the function with the arguments (1, 4, 5)?


a) The function will return the value 10.
b) The function will return the value 20.
c) The function will return the value 5.
d) The function will return the value 15.
e) The function will return the value 25.

Essa pergunta também está no material:

Introdução À Linguagem Python
1 pág.

💡 1 Resposta

User badge image

Ed Verified user icon

A resposta correta é d) A função retornará o valor 15. Isso ocorre porque a função calcular segue a ordem de operações matemáticas, multiplicando y e z primeiro e depois somando x ao resultado. Portanto, calcular(1, 4, 5) é o mesmo que 1 + 4 * 5, que é igual a 21.

0
Dislike0

✏️ Responder

SetasNegritoItálicoSublinhadoTachadoCitaçãoCódigoLista numeradaLista com marcadoresSubscritoSobrescritoDiminuir recuoAumentar recuoCor da fonteCor de fundoAlinhamentoLimparInserir linkImagemFórmula

Para escrever sua resposta aqui, entre ou crie uma conta

User badge image

Outros materiais