class Student{
//Regestration no, Name, semester, degree
constructor(regNo, name, degree, semeter) {
    this.regNo = regNo;
    this.name = name;
    this.degree = degree;
    this.semeter = semeter;
}
}
let studentsSet = new Set();
studentsSet.add(new Student("FA20-BCS-084","Muhammad Abdullah","BSCS","5th"));
studentsSet.add(new Student("FA20-BCS-084","Muhammad Abdullah","BSCS","5th"));
console.log(studentsSet);
**output**
Set(2) {
  Student {
    regNo: 'FA20-BCS-084',
    name: 'Muhammad Abdullah',
    degree: 'BSCS',
    semeter: '5th'
  },
  Student {
    regNo: 'FA20-BCS-084',
    name: 'Muhammad Abdullah',
    degree: 'BSCS',
    semeter: '5th'
  }
}
Although both objects are having same values, but I want to compare both objects on the basis of regNo field, and definitely, both fields are the same in this case So, I want to get only one object in the Set. but the question is how? like we have a concept of hashcode and equals in java. is there anything similar to that in JS?
 
    