//index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Document</title>
</head>
<body>
<header>
<h1></h1>
</header>
<main class="container">
<button onclick="pressConsole();" class="button">Console</button>
<button onclick="alerta();" class="button">Alert</button>
<button onclick="ciudadBrasil();" class="button">Prompt</button>
<button onclick="summa();" class="button">Suma</button>
</main>
<script src="app.js"></script>
</body>
</html>
//app.js
let titulo = document.querySelector('h1');
titulo.innerHTML = 'Hora del desafio';
function pressConsole() {
alert('El boton fue clicado');
}
function ciudadBrasil() {
let ciudad = prompt('Ingrese una ciudad de Brasil');
alert(`Estuve en ${ciudad}, y me acorde de ti`);
}
function alerta() {
alert('Yo amo JS');
}
function summa() {
let num1 = parseInt(prompt('Ingrese un numero por favor'));
let num2 = parseInt(prompt('Ingrese otro numero por favor'));
summa = num1 + num2;
alert(`El resultado de la suma es: ${summa}. Gracias`);
}