Hello, You چالش 1 از جلسهی 8، آسان
کاربر اسمش را در کادر مینویسد و دکمه را میزند.
داخل جعبهی دکمه، نوشتهی کادر (box.value) را بخوان و در خط msg بنویس Hello, و بعد اسم. مثلاً برای Sara: Hello, Sara
<style>
body { font-family: sans-serif; text-align: center; padding: 16px; }
button, input, select { font-size: 16px; min-height: 40px; margin: 4px; }
</style>
<input id="name" placeholder="Your name">
<button id="go" onclick="press()">Go</button>
<p id="msg"></p>
<script>
let box = document.getElementById("name");
let line = document.getElementById("msg");
function press() {
// your code here
}
</script>
راهنما و جواب این چالش · برگشت به درس جلسهی 8: از کاربر بپرس · چالش بعدی: Count the Letters
بیشتر بخوان: جاوااسکریپت چیست؟ از دکمهی وب تا Node.js