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

Where Is the Hero? چالش 2 از جلسه‌ی 13، آسان

شکل Point آماده است، ولی Hero هنوز ساخته نشده و برنامه خط قرمز می‌دهد.
با interface شکل Hero را بساز: name از نوع string و pos از نوع Point.
برنامه باید Mina 2 5 را نشان بدهد.

<style>
body { font-family: sans-serif; text-align: center; padding: 16px; }
button, input, select { font-size: 16px; min-height: 40px; margin: 4px; }
#out { direction: ltr; text-align: left; font: 16px monospace; margin: 12px 0; padding: 12px; min-height: 28px; border-radius: 12px; background: #0f172a; color: #e2e8f0; white-space: pre-wrap; overflow-wrap: anywhere; }
#out .line { min-height: 22px; }
</style>

<pre id="out"></pre>

<script type="text/typescript">
interface Point {
  x: number;
  y: number;
}

// make the interface Hero here

const hero: Hero = { name: "Mina", pos: { x: 2, y: 5 } };
show(hero.name, hero.pos.x, hero.pos.y);
</script>

راهنما و جواب این چالش · برگشت به درس جلسه‌ی 13: چیز در چیز · چالش بعدی: Type the Total

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