MCPcopy Create free account
hub / github.com/Asabeneh/30-Days-Of-JavaScript / Student

Class Student

15_Day_Classes/15_day_starter/scripts/main.js:52–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50console.log(Person.favoriteSkill())
51
52class Student extends Person {
53 constructor(firstName, lastName, age, country, city, gender) {
54 super(firstName, lastName, age, country, city)
55 this.gender = gender
56 }
57
58 saySomething() {
59 console.log('I am a child of the person class')
60 }
61 getPersonInfo() {
62 let fullName = this.getFullName()
63 let skills =
64 this.skills.length > 0 &&
65 this.skills.slice(0, this.skills.length - 1).join(', ') +
66 ` and ${this.skills[this.skills.length - 1]}`
67
68 let formattedSkills = skills ? `He knows ${skills}` : ''
69 let pronoun = this.gender == 'Male' ? 'He' : 'She'
70
71 let info = `${fullName} is ${this.age}. ${pronoun} lives in ${this.city}, ${this.country}. ${formattedSkills}`
72 console.log(this)
73 return info
74 }
75}
76
77const s1 = new Student(
78 'Asabeneh',

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected