对象未定义,但我认为范围和声明没问题

Object not defined but i think scope and declaration is ok

当我尝试 运行 来自该对象的方法时,它说该对象未定义。如果这是一个愚蠢的问题,我很抱歉,我检查了很多次,但似乎找不到错误,所以我感谢你的帮助和耐心。

let Sunce= {
  dvaujedan: function (name){
    this.prva(name);
    this.druga();
  },
  prva: (name){
    switch(name){
      case "Elena":
        player = new Player ("Elena" , 100, 200, 50, 100, 400);
        break;
      case "Anabel":
        player = new Player ("Anabel" , 200, 300, 150, 200, 100);
        break;
      case "Silvia":
        player = new Player ("Silvia" , 100, 200, 50, 200, 300);
        break;
    } 

    let getinterface =document.querySelector(".interface");
    getinterface.innerHTML= '<img src="img/player/' + 
      player.name.toLowerCase() + '.jpg"> <h3>' + 
      player.name + '</h3><p>Speed:' + player.speed + '</p><p>Health:' + 
      player.health + '</p><p>Damage:' + player.damage + 
     '</p><p>Agility:' + player.agility + 
     '</p><p>Mana:' + player.mana + '</p>';
    },
    druga: (){}
}

由于 prvadruga,该对象似乎会导致 SyntaxError。您应该为这两个功能添加 function

dvaujedan: function (name){
...
},
prva: function (name){
...
},
druga: function (){}