Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Tabuada/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Exemplo 6 - Aula 4</title>
</head>
<body>
<button type="button" id="btn">Calcular</button>

<div id="relatorio"></div>


<script src="./script/script.js"></script>
</body>
</html>
22 changes: 22 additions & 0 deletions Tabuada/script/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"use strict";

let botao = document.getElementById('btn');
let div = document.querySelector('#relatorio');

botao.addEventListener('click', function () {

let tab = Number(prompt('Digite a tabuada: '));
div.innerHTML = '';

//console.log(`${tab} x 0 = ${tab * 0}`); --> Forma Ineficaz!
//console.log(`${tab} x 1 = ${tab * 1}`);
//console.log(`${tab} x 2 = ${tab * 2}`);
//console.log(`${tab} x 3 = ${tab * 3}`);
//console.log(`${tab} x 4 = ${tab * 4}`);
//console.log(`${tab} x 5 = ${tab * 5}`); --> Forma Ineficaz!

for (let i = 0; i <= 10; i += 1) { // --> Forma Eficaz

div.innerHTML += `${tab} x ${i} = ${tab * i} <br>`;
}
});