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.
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
0
✏️ Responder
Para escrever sua resposta aqui, entre ou crie uma conta
Compartilhar