Mongoose/MongoDB result fields appear undefined in Javascript

前端 未结 10 2278
囚心锁ツ
囚心锁ツ 2020-11-27 20:13

Is there something that I\'m missing that would allow item to log as an object with a parameter, but when I try to access that parameter, it\'s undefined?

What I\'ve

10条回答
  •  野性不改
    2020-11-27 20:38

    Are you initializing your object?

    function MyObject()
    {
        this.Title = "";
        this.Content = "";
    }
    
    var myo1 = new MyObject();
    

    If you do not initialize or have not set a title. You will get undefined.

提交回复
热议问题