app.js:
let titulo = document.querySelector('h1');
titulo.innerHTML = "Hora del desafio";
function clickConsole(){
alert("El botón fue clicado");
};
function nombreCiudad(){
let ciudadUsuario = prompt("Por favor ingrese una ciudad de Brazil.");
alert(`Estuve en ${ciudadUsuario} y me acordé de ti`)
};
function alertaJS(){
alert("Yo amo JS")
}
function sumarNumeros(){
let numero1 = parseInt(prompt("Ingrese un número."));
let numero2 = parseInt(prompt("Ingrese otro número"));
let totalsuma = numero1 + numero2;
alert(`La suma de sus numeros es: ${totalsuma}`);
}
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="clickConsole();" class="button">Console</button>
<button onclick="alertaJS();" class="button">Alert</button>
<button onclick="nombreCiudad();" class="button">Prompt</button>
<button onclick="sumarNumeros();" class="button">Suma</button>
</main>
<script src="app.js"></script>
</body>
</html>