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

One Bar چالش 1 از جلسه‌ی 12، آسان

در تابع show() قدِ میله‌ی #bar را n پیکسل کن (با style.height و "px"). اول n برابر 120 است و دکمه‌ی #grow آن را ۳۰ تا بیشتر می‌کند.

<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body { font-family: Tahoma, sans-serif; margin: 0; background: #f4f6fb; color: #222; }
.screen { max-width: 420px; margin: 0 auto; padding: 16px; }
input, select { font-size: 16px; min-height: 44px; box-sizing: border-box; }
button { font-size: 16px; min-height: 44px; padding: 0 16px; }
</style>
<style>
#bar { width: 60px; background: #4a90e2; border-radius: 6px 6px 0 0; }
</style>
<div class="screen" dir="rtl">
  <h1>یک میله</h1>
  <div id="bar"></div>
  <button id="grow" onclick="n = n + 30; show()">بلندتر</button>
</div>

<script>
let n = 120;

function show() {
}

show();
</script>

راهنما و جواب این چالش · برگشت به درس جلسه‌ی 12: نمودار ساده · چالش بعدی: Bars from a List

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