thinkful
class Thinkful { constructor() { this.isTrash = true; this.hatesStudents = true; this.lovesMoney = true; this.hasBiweekly45MinuteMentorSessions = false; this.hrPersonnelHaveFreeMacBooks = true; this.hrPersonnelAreUseful = false; this.hasGoodAssignmentSystem = false; this.hasThreeUsefulEmployees = true; this.allowsLinux = Math.ceil(Math.random() * 10) > 5; // changes quite a bit... ^^^^ } respondToCriticism(studentIsDoingWell, studentHasBeenKicked) { if (studentIsDoingWell) { console.log("We'll take a look at this..."); console.log("Thank you for bringing this to our attention!"); this.doNothing(); } else if (studentHasBeenKicked) { this.doNothing(); } else { this.doNothing(); this.shadowKickStudentFromProgram(); } } get studentTearsAndMoneyForFree() { this.shadowKickStudentFromProgram(); return `Yummy yummy tears and money`; } doNothing() {} testCodeWithQualified(codeActuallyWorks) { if (codeActuallyWorks && Math.ceil(Math.random() * 10) > 5) { return ( `You passed! Watch me forever though... I may decide to just break` + `and then you will get ${this.shadowKickStudentFromProgram()}'ed :)` ); } else { this.doNothing(); this.shadowKickStudentFromProgram(); } } // yes i know this recursion may never break... // yes that is the point. sendSpamEmailsRegardlessOfEnrollmentStatus(studentIsEnrolled) { console.log( "Join the weekly AMA where we will repeat policies and crush your souls!" ); console.log("When should you take a study break? How about forever."); if (studentIsEnrolled) { return this.shadowKickStudentFromProgram(); } this.sendSpamEmailsRegardlessOfEnrollmentStatus(); } honorStudentEnrollmentContract() { return "...No."; } fixSeriousProblemsThatAreStoppingStudentsFromWorkingEfficiently() { this.doNothing(); } shadowKickStudentFromProgram(student) { student = null; this.sendSpamEmailsRegardlessOfEnrollmentStatus(false); return student; // to hell } }
Here is what the above code is Doing:
1. It’s creating a class called Thinkful.
2. It’s creating a constructor function that sets a bunch of properties.
3. It’s creating a method called respondToCriticism.
4. It’s creating a getter called studentTearsAndMoneyForFree.
5. It’s creating a method called doNothing.
6. It’s creating a method called testCodeWithQualified.
7. It’s creating a method called sendSpamEmailsRegardlessOfEnrollmentStatus.
8. It’s creating a method called honorStudentEnrollmentContract.
9. It’s creating a method called fixSeriousProblemsThatAreStoppingStudentsFromWorkingEfficiently.
10. It’s creating a method called shadowKickStudentFromProgram.