title: Uncaught TypeError: this.initTimer is not a function
body: <p>Modular refactoring of javascript is in progress. When executing the codes below in the game class start method, an error like this.initTimer is not a function is output. Not only initTimer but also the code below shows an error like is not a function. How can I solve this?</p>
  <p>game.js</p>
  <pre><code>'use strict';
  import * as sound from './sound.js';
  import Field from './field.js';
  
  export default class Game{
      constructor(gameDuration){
          this.gameDuration = gameDuration;
          this.gameTimer = document.querySelector('.game__timer');
          this.gameField = new Field();
          this.gameField.setClickListener(this.onFieldClick);
          this.startBtn = document.querySelector('.game__startBtn');
          this.startBtn.addEventListener('click', this.start);
          this.started = false;
          this.timer = undefined;
          this.level = 0;
      }
      onFieldClick = (stage, win) =&gt; {
          if(!this.started){
              return;
          }
          if(this.level == 0){
              if(stage == 'first' &amp;&amp; win == 'win'){
                  this.finish('win');
              }else if(stage == 'first' &amp;&amp; win == 'lose'){
                  this.finish('lose');
              }
          }
          if(this.level == 1){
              if(stage == 'second' &amp;&amp; win == 'win'){
                  this.finish('win');
              }else if(stage == 'second' &amp;&amp; win == 'lose'){
                  this.finish('lose');
              }
          }
          if(this.level == 2){
              if(stage == 'third' &amp;&amp; win == 'win'){
                  this.finish('finish');
              }else if(stage == 'third' &amp;&amp; win == 'lose'){
                  this.finish('lose');
              }
          }
      }
      
      onItemClick(button) {
          if(button == 'next'){
              ++this.level;
          }
          if(button == 'finish'){
              this.level = 0;
          }
          start();
      }
  
      setGameStopListener(onGameStop){
          this.onGameStop = onGameStop;
      }
      
      start() {
          this.started = true;
          this.initTimer();
          this.gameField.hideStartContent;
          this.setBackgroundImg();
          this.showTimer();
          sound.playBackground();
          this.startTimer();
      }
      
      finish(win){
          this.started = false;
          this.stopTimer();
          sound.stopBackground();
          if(win == 'win' || win == 'finish'){
              sound.playWin();
          }
          if(win == 'lose') {
              sound.playAlert();
          }
          this.onGameStop &amp;&amp; this.onGameStop(win);
      }
      
      initTimer(){
          this.timer = undefined;
      }
  
      setBackgroundImg(){
          let imgPath = `url(img/game__field/stage${this.level}.jpg)`;
          this.gameField.setBackgroundImage(imgPath);
      }
  
      showTimer() {
          this.gameTimer.style.visibility = 'visible';
      }
  
      startTimer() {
          let remainingTimeSec = this.gameDuration;
          this.updateTimerText(remainingTimeSec);
          this.timer = setInterval(() =&gt; {
              if(remainingTimeSec &lt;= 0) {
                  clearInterval(timer);
                  sound.stopBackground();
                  this.finish('lose');
                  return;
              }
              this.updateTimerText(--remainingTimeSec);
          }, 1000);
      }
  
      updateTimerText(time) {
          const minutes = Math.floor(time / 60);
          const seconds = time % 60;
          this.gameTimer.innerHTML = `${minutes}:${seconds}`;
      }
  
      stopTimer() {
          clearInterval(this.timer);
      }
  }
  </code></pre>
  <p><em><strong>OutPut</strong></em></p>
  <blockquote>
  <p>game.js:60 Uncaught TypeError: this.initTimer is not a function
  at HTMLImageElement.start (game.js:60)</p>
  </blockquote>
  <p><em><strong>Expected</strong></em></p>
  <blockquote>
  <p>Sequencing of code inside start</p>
  </blockquote>