B. Recta usando ciclos

Salida

Ábrelo en otra pestaña.

Revísalo en gilpgedit.

1<!DOCTYPE html>
2<html lang="es">
3
4<head>
5 <meta charset="utf-8">
6 <meta name="viewport"
7 content="width=device-width">
8 <title>Línea</title>
9</head>
10
11<body>
12 <script>
13 for (let x = 0; x < 200
14 ; x += 20) {
15 let y = 0.45 * x + 30;
16 document.body.innerHTML +=
17 /* html */
18 `<div
19 style="position: absolute;
20 bottom: ${y}px;
21 left: ${x}px;">
22 💕
23 </div>`
24 }
25 </script>
26</body>
27
28</html>
skip_previous skip_next