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

Greeting Button چالش 5 از جلسه‌ی 7، سخت

دکمه‌ای بساز که هر بار سلام کند و بگوید بار چندم است. داخل جعبه‌ی دکمه:
- count را یکی زیاد کن.
- در خط msg بنویس: Hello, Sara! Press 1 (اسم از name و عدد از count).
بار دوم باید بنویسد Hello, Sara! Press 2 و همین‌طور ادامه بدهد.

<style>
body { font-family: sans-serif; text-align: center; padding: 16px; }
button, input, select { font-size: 16px; min-height: 40px; margin: 4px; }
</style>

<button id="go" onclick="press()">Hello</button>
<p id="msg"></p>

<script>
const name = "Sara";
let count = 0;
let line = document.getElementById("msg");

function press() {
  // your code here
}
</script>

راهنما و جواب این چالش · برگشت به درس جلسه‌ی 7: متن · چالش بعدی: Find the Bugs

بیشتر بخوان: جاوااسکریپت چیست؟ از دکمه‌ی وب تا Node.js