Imagem de fundo

Um arquivo HTML será carregado com a implementação a seguir...

Um arquivo HTML será carregado com a implementação a seguir em um navegador web:


<html>


<head>


<script src=https://code.jquery.com/jquery-3.6.0.js crossorigin="anonymous">

</script>

<script type="text/javascript">

$(document).ready(function()___{

$("#btn1").click(function()___{

alert(processa($("#n1").val() ) )

} ) ;

$(".btn").click(function() ___{

var a = 2;

var b = [4, function () {}, 'A' ] ;

var c = ($("#n2").html() / a) != 2;

var x = $("#n1").val();

alert ( ( jQuery.isFunction(b[1]) && c) ? x * a : x / a);

} ) ;

} ) ;

function processa(x) {

return x ** 3;

}

</script>

</head>


<body>


<input id="n1" type="hidden" value="2">

<div id="n2">4</div>

<button id="btn1" class="btn-primary">A</button>

<button id="btn2" class="btn">B</button>

</body>


</html>


Considerando os conceitos de jQuery, o acionemento do botão "B" irá exibir em tela o valor:


A

8


B

6


C

4


D

1