بتل کد Battle Codeدارد باز می‌شود…

جواب «Step 3: Say Good Morning» چالش 3 از جلسه‌ی 4

سؤال

قدم سوم: صبح بخیر بگو. زیر کد قبلی:
- خط msg را پیدا کن و اسمش را line بگذار.
- متنش را Good morning بگذار.
- اندازه‌ی نوشته را 32px کن.

راهنما

line.textContent = "Good morning"; و line.style.fontSize = "32px"; (با px).

یک جواب درست

<style>
body { font-family: sans-serif; text-align: center; padding: 16px; }
button, input, select { font-size: 16px; min-height: 40px; margin: 4px; }
.lamp { font-size: 80px; width: 130px; margin: 12px auto; border-radius: 24px; background: #334155; filter: grayscale(1); opacity: 0.5; }
.lamp.on { background: #fde047; filter: none; opacity: 1; }
.door { font-size: 70px; width: 110px; margin: 12px auto; border-radius: 12px; background: #92400e; }
.door.open { background: #86efac; }
</style>

<div id="door" class="door">🚪</div>
<div id="lamp" class="lamp on">💡</div>
<p id="msg"></p>

<script>
// 1. open the door
let door = document.getElementById("door");
door.classList.add("open");

// 2. turn the night lamp off
let lamp = document.getElementById("lamp");
lamp.classList.toggle("on");

// 3. say good morning
let line = document.getElementById("msg");
line.textContent = "Good morning";
line.style.fontSize = "32px";
</script>

اول خودت امتحان کن؛ جواب‌های دیگر هم قبول است. برگرد و خودت حلش کن