-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasicjavascript.html
More file actions
39 lines (34 loc) · 1.12 KB
/
Copy pathbasicjavascript.html
File metadata and controls
39 lines (34 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Curso básico Javascript de Platzi</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link rel='stylesheet' type='text/css' media='screen' href='main.css'>
<script src='main.js'></script>
</head>
<body>
<h1>Funciones JavaScript</h1>
<h2>Función ejecutada directamente:</h2>
<script>let a = 1;
let b = 2;
console.log(a+b);
document.write(a+b);</script>
<h2>Función a la que llamamos con parámetros:</h2>
<h3>Sumar 15 + 48 = </h3>
<script>//alert("Se ejecutará la suma")
document.write(sumar(15,48));
//alert("Se ha ejecutado la suma");</script>
<script>//secuenciar(prompt("Ingresar un número chico"));</script>
<button onclick="myFunction()">Generar número aleatorio</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = Math.floor((Math.random() * 10) + 1);
document.getElementById("demo").innerHTML = x;
document.write("<p>"+x+"</p>");
}
</script>
</body>
</html>