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

Read the Fields چالش 1 از جلسه‌ی 28، آسان

دو شیء داریم: kitchen و bath. هر دکمه یکی از آن‌ها را به تابع show می‌دهد.
داخل show یک خط بنویس که در #msg اسم و دمای همان اتاق را بنویسد، این شکلی: Kitchen: 22

<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="b1" onclick="show(kitchen)">Kitchen</button>
<button id="b2" onclick="show(bath)">Bath</button>
<p id="msg"></p>

<script>
const kitchen = { name: "Kitchen", temp: 22 };
const bath = { name: "Bath", temp: 25 };

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

راهنما و جواب این چالش · برگشت به درس جلسه‌ی 28: شیء · چالش بعدی: Make an Object

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