30 lines
1005 B
HTML
30 lines
1005 B
HTML
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Übung 2: Ist es noch weit? Sind wir schon da?</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" />
|
|
</head>
|
|
<body>
|
|
<main>
|
|
<div class="container py-5">
|
|
<div class="alert alert-primary">
|
|
<h2>Übung 2: Ist es noch weit? Sind wir schon da?</h2>
|
|
<p>Die Formel zur Berechnung von Entfernungen lautet:</p>
|
|
<code>
|
|
<pre>Math.sqrt((yDestination - yOrigin) ** 2 + (xDestination - xOrigin) ** 2);</pre>
|
|
</code>
|
|
<p>Schreibe eine Funktion distance, die du z. B. folgendermaßen aufrufen kannst:</p>
|
|
<code>
|
|
<pre>distance({ x: 1, y: 1 }, { x: 5, y: 1 }); // => 4</pre>
|
|
</code>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
<script>
|
|
'use strict';
|
|
</script>
|
|
</body>
|
|
</html>
|