So I'm part of a bootcamp that helps you get job ready to do web development. I hit a snag and wanted to know if anyone could shed some light. inTruth('I', 'is', 'dumb'); The goal is to have the Bootstrap class's method "registerStudent", verify if there is a matching object within it's array "students" if there is, it say "there is already a student registered", if not it will add the called method and add the object to the class's array. If my explanation isn't through. runApology('I', 'am', 'sorry', * 2);
HTML
<head>
<title>Nucamp Community Coding Bootcamp</title>
</head>
<body>
<h1>Nucamp Community Coding Bootcamp</h1>
<script src="ReactWeek1Assignment.js"></script>
</body>
</html>
class Student {
constructor(name, email, community) {
this.name = name;
this.email = email;
this.community = community;
}
}
class Bootcamp {
constructor(name, level, students = []) {
this.name = name;
this.level = level;
this.students = students;
}
registerStudent(studentToRegister) {
if (this.students.filter(s => s === studentToRegister)){
this.students.push(studentToRegister);
console.log(`Registering ${studentToRegister.name} to ${this.name} with email ${studentToRegister.email}`);
return this.students;
} else {
console.error(`${studentToRegister.name} is not registered`);
return this.students;
}
}
}