41 lines
1.1 KiB
HTML
41 lines
1.1 KiB
HTML
<!doctype html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Übung 31: In die Konsole geloggt, Teil 2</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">
|
|
<h1>Übung 31: In die Konsole geloggt, Teil 2</h1>
|
|
<p>Schreiben Sie eine Funktion, die Ihren Namen in der Konsole ausgibt.</p>
|
|
<div class="output alert alert-secondary my-3"></div>
|
|
</div>
|
|
</main>
|
|
<script>
|
|
'use strict';
|
|
|
|
const outputEl = document.querySelector('.output');
|
|
|
|
const outputName = (name) => {
|
|
console.log(name);
|
|
alert(name);
|
|
};
|
|
|
|
outputName('Max Power');
|
|
|
|
// =====
|
|
|
|
const getName = (name) => {
|
|
return name[0].toUpperCase() + name.substring(1).toLowerCase();
|
|
};
|
|
|
|
console.log(getName('philippe'));
|
|
alert(getName('adel'));
|
|
outputEl.textContent = getName('KaHlEeL');
|
|
</script>
|
|
</body>
|
|
</html>
|