how can i get all value from this object into a tabular form? I have no idea how to do this?

Viewed 17

i have tried console.table(user); but that does not show value of array in courselist.

i want courseList value similar to other values in one row

        var user = {
  firstName: "piyush",
  lastName: "raj",
  role: "admin",
  loginCount: 32,
  courseList: [],
  buyCourse: function (courseName) {
    this.courseList.push(courseName);
  },
  getCourseCount: function () {
    return `${this.firstName} is enrolled in total of ${this.courseList.length} courses`;
  },
    info: function () {
      return 
    },
};

user.buyCourse("react js");
user.buyCourse("angular js");



0 Answers
Related