Browse Source

3.4: using let, const, and built-in types.

Frederic G. MARAND 5 years ago
parent
commit
fb7eb5cbd8
1 changed files with 9 additions and 1 deletions
  1. 9 1
      app/app.ts

+ 9 - 1
app/app.ts

@@ -1,7 +1,15 @@
 function startGame() {
   // Starting a new game.
-  const messagesElement = document.getElementById('messages');
+  const playerName: string = 'Audrey';
+  logPlayer(playerName);
+
+  const messagesElement: HTMLElement = document.getElementById('messages');
   messagesElement.innerText = 'Welcome to MultiMath! Starting a new game';
+  console.log('Starting new game');
+}
+
+function logPlayer(name: string) {
+  console.log(`New game starting for player: ${name}.`);
 }
 
 document.getElementById('startGame').addEventListener('click', startGame);