有人可以帮我这个功能的代码吗?

can someone help me with the code for this function?

你好,所以我必须做一个函数,当我调用它时必须向我显示学生信息,我必须调用它 getInfo 所以我尝试了类似的方法,但我不知道我必须输入什么代码对于功能: 有人可以帮助我吗:

class Student {
    Name
    Adress
    Phone
    Course 
    Constructor(Name,Phone,Adress) {
       
    }
}
var Name= "Stefan"
var Adress= "Strada Campia Islaz numarul 50"
var Phone="+40766334455"
var Course="Curs Javascript"
function getinfo(Name, Adress, Phone,Course) {
    
}

class 应该将函数保存为 class 方法。我不确定您最终将如何编写代码,但这里有一个示例:

class Student {

  // The student data is passed in as an object
  // and we assign each property to the new instance
  constructor(obj) {
    Object.entries(obj).forEach(([k, v]) => this[k] = v);
  }
  
  // getInfo simply returns the type
  getInfo(type) {
    return this[type];
  }

}

const data = {
  name: "Stefan",
  address: "Strada Campia Islaz numarul 50",
  phone: "+40766334455",
  course: "Curs Javascript"
};

// Create a new student instance from the class
// passing in the data object
const student1 = new Student(data);

// Call the getInfo function with the type
console.log(student1.getInfo('name'));
console.log(student1.getInfo('course'));

const data2 = {
  name: "Jo",
  address: "Mars",
  phone: "+85435435",
  course: "Acupuncture 101"
};

const student2 = new Student(data2);

console.log(student2.getInfo('name'));
console.log(student2.getInfo('course'));

class Student {
  constructor(name, adress, phone, course) {
    this.name = name;
    this.adress = adress;
    this.phone = phone;
    this.course = course;
  }

  getInfo() {
    console.log(this.name);
    console.log(this.adress);
    console.log(this.phone);
    console.log(this.course);
  }
}

var newStudent = new Student('Stefan', 'Strada Campia Islaz numarul 50', '+40766334455', 'Curs Javascript');
newStudent.getInfo();