📜  thinkful - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:41.053000             🧑  作者: Mango

代码示例1
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
  }
}