recherche

Maison  >  Questions et réponses  >  le corps du texte

javascript - Débutant demandant de l'aide : pourquoi Console.log renvoie-t-il ici undefined ?

function d(){this.get=function(){this.getNum()}};
d.prototype.getName=function(){return 3;};
var d = new d();
console.log(d.get());//undefined

Pourquoi undéfini est-il affiché ici ? Au lieu de 3 ? Merci de répondre

滿天的星座滿天的星座2836 Il y a quelques jours610

répondre à tous(6)je répondrai

  • 怪我咯

    怪我咯2017-05-19 10:48:15

    function d(){this.get=function(){return this.getName()}};
    d.prototype.getName=function(){return 3;};
    var d = new d();
    console.log(d.get());//undefined

    répondre
    0
  • 迷茫

    迷茫2017-05-19 10:48:15

    function d(){this.get=function(){return this.getNum()}};

    Qu'en dis-tu

    répondre
    0
  • 某草草

    某草草2017-05-19 10:48:15

    function d(){this.get=function(){return this.getName();}};
    d.prototype.getName=function(){return 3;};
    var d = new d();
    console.log(d.get());

    Comparez-vous

    répondre
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-19 10:48:15

    nom nom

    répondre
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-19 10:48:15

    this.getnum改成this.getname

    répondre
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-19 10:48:15

    function d(){
                this.get= function(){
                    return this.getName()
                }
            };
            d.prototype.getName = function(){
                return 3;
            };
            var d = new d();
            console.log(d.get());  

    répondre
    0
  • Annulerrépondre