You don't have access to this class

Keep learning! Join and start boosting your career

Aprovecha el precio especial y haz tu profesión a prueba de IA

Antes: $249

Currency
$209
Suscríbete

Termina en:

0 Días
10 Hrs
44 Min
13 Seg

Playgrounds: Sobrescribir métodos heredados

19/20

Contributions 48

Questions 5

Sort by:

Want to see more contributions, questions and answers from the community?

Mi solución, solo use template literals y el metodo join(). Aprendí mucho en este curso.

import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student{
  constructor(props, skills=[]) {
    super(props);
    this.skills = skills;
  }
  publicarComentario(commentContent) {   
    const role = `profesor de ${this.skills.join(",")}`;
    //console.log(role);
    const comment = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRole: role
    });
    return comment.publicar();
  }
}

Este es mi aporte.
Nota: Tengan cuidado cuando escriban el studentRole, porque el editor solo recibe profesor de, si le colocas otra cosa como, yo soy profesor de, te lo tacha como malo.

import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student{

  constructor(props, skills = []) {
    super(props);
    this.skills = skills;
  }

  publicarComentario(commentContent) {
    const comment = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRole: `profesor de ${this.skills.join()}`
    });
    return comment.publicar();
  }
<code> 

Algunos enunciados de las guías no se pueden ver por completo. Tendría que haber un scroll horizontal.

import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student {
  constructor(props, skills = []) {
    super(props);
    this.skills = skills;
  }
  approveCourse(newCourse) {
    this.approvedCourses.push(newCourse);
  }
  publicarComentario(commentContent) {
    let skills = "profesor de " + this.skills.join(",");
    const comment = new Comment({ content: commentContent, studentName: this.name, studentRole: skills });
    return comment.publicar();
  }
}

Adjunto mi solución
.
.
.
.
.
.
.
.

import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student {
  // Tu código aquí 👈
  constructor(props, skills = []) {
    super(props);
    this.skills = skills;
  }

  publicarComentario(commentContent) {
    const comment = new Comment({
      studentRole: `profesor de ${this.skills}`,
      content: commentContent,
      studentName: this.name,
    });
    return comment.publicar();
  }
}

¡Hola! Queriendo contemplar el escenario de instanciar estudiantes y profesores de la clase madre, modifiqué para uso personal la clase Comment, quedando de la siguiente forma:

export default class Comment {
    constructor({ content, studentName, studentRole = "estudiante" }) {
        this.content = content;
        this.studentName = studentName;
        this.studentRole = studentRole;
        this.likes = 0;
    }

    publicar() {
        // let comentario = {
        //     studentName: this.studentName + " (" + this.studentRole + ")",
        //     likes: this.likes + " likes",
        //     content: this.content,
        // };
        let comentario = {};
        if (this.studentRole === "estudiante") {
            comentario = {
                studentName: this.studentName + " (" + this.studentRole + ")",
                likes: this.likes + " likes",
                content: this.content,
            };
        } else {
            comentario = {
                studentName:
                    this.studentName + " (profesor de " + this.studentRole + ")",
                likes: this.likes + " likes",
                content: this.content,
            };
        }
        return comentario;
    }
}

La clase Teacher Student

export class TeacherStudent extends Student {
    constructor(props, skills = []) {
        super(props);
        this.skills = skills;
    }
    publicarComentario(commentContent) {
        const comment = new Comment({
            content: commentContent,
            studentName: this.name,
            studentRole: this.skills,
        });
        return comment.publicar();
    }
}

Y a la clase que debemos crear de TeacherStudent se envían las habilidades ya con el .join():

const skills = ["js", "python", "mongodb"];
const props = {
    name: "Erik Ochoa",
    username: "elyager",
};
const profesor = new TeacherStudent(props, skills.join());
console.log(profesor.publicarComentario("Mi primer comentario"));

Espero que te sea de útilidad.

Tuve que ver mas de mil veces las clases pero lo logre sin ver la solución,
les comparto el código:

import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student {
  constructor(props, skills) {
    super(props);
    this.skills = skills
  }

  publicarComentario(commentContent) {
    const comment = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRole: "profesor de " + this.skills
    });
    return comment.publicar();
  }
}

Este es mi aporte

import { Comment } from "./Comment";
import { Student } from "./Student";


export class TeacherStudent extends Student {

  constructor(props, skills = []) {
    super(props);

    this.skills = skills;

  }
  publicarComentario(commentContent) {
    const comment = new Comment({
      content: commentContent,
      studentName: `${this.name}`,
      studentRole: `profesor de ${this.skills.join(',')}`
    });
    return comment.publicar();
  }
}

Solución

export class TeacherStudent extends Student {
  // Tu código aquí 👈
  constructor(props, skills = []) {
    super(props);
    this.skills = skills;
  }

  publicarComentario(commentContent) {
    const comment = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRole: "profesor de " + this.skills.join()
    })
    return comment.publicar();
  }
}

Este es mi aporte, lo hice haciendo manejo de strings con el metodo concat(), aunque viendo los comentarios me di ceutna de que era mas sencillo haciendolo con join()

import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student{
  constructor(props, skills=[]) { 
    super(props)
    this.skills = skills
  }
  publicarComentario(commentContent) {
      let nuevoTexto = ''
    for (let i = 0; i < this.skills.length; i++) { 
      if (i == 0) {
        nuevoTexto = nuevoTexto.concat('', this.skills[i])
      } else {nuevoTexto = nuevoTexto.concat(',', this.skills[i])}
    }
    const comment = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRole: `profesor de ${nuevoTexto}`
    });
    return comment.publicar();
  }
}
import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student { // Define una nueva clase TeacherStudent que hereda de Student
  constructor(props, skills = []) { // Define un constructor que toma un objeto de props y un array opcional de skills
    super(props); // Llama al constructor de la clase base (Student) con props
    this.skills = skills; // Inicializa la propiedad skills de la instancia con el valor de skills pasado como argumento
  }

  publicarComentario(commentContent) { // Define un nuevo método publicarComentario
    const comment = new Comment({ // Crea una nueva instancia de Comment con las siguientes propiedades
      content: commentContent, // El contenido del comentario se establece en el argumento commentContent
      studentName: this.name, // El nombre del estudiante es el nombre de la instancia TeacherStudent
      studentRole: "profesor de " + this.skills.join(","), // El rol del estudiante se establece en "profesor de skill1,skill2,..."
    });
    return comment.publicar(); // Llama al método publicar de la instancia de Comment y devuelve el resultado
  }
}

En resumen, la clase TeacherStudent extiende la clase Student y añade una propiedad skills y un método publicarComentario que crea una nueva instancia de Comment con la información del estudiante y los skills y lo publica.

import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student{
  // Tu código aquí 👈
  constructor(atributies, skills = []) {
    super(atributies);
    this.skills = skills;

  }

  publicarComentario(commentContent) {
    const comment  = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRole: `profesor de ${this.skills.join(",")}` ,

    });
    return comment.publicar();
  }
}```

He aquí mi codigo:

import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student {
  // Tu código aquí 👈
  constructor(props, skills = []) {
    super(props);
    this.skills = skills;
    this.studentRole = 'profesor';
  }
  publicarComentario(commentContent) {
    const comment = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRole: this.studentRole + " de " + this.skills.join(","),
      skills: this.skills,
    });
    console.log(comment);
    return comment.publicar();
  }
}

Solución… 😄
.
.
.
.

.
.

import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student {
  constructor(props, skills = []) {
    super(props);
    this.skills = skills;
  }

  publicarComentario(commentContent) {
    const comment = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRole: `profesor de ${this.skills.join()}`,
    });
    return comment.publicar();
  }
}
import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student {
  // Tu código aquí 👈
  constructor(skills = [], props) {
    this.skills = skills;
    super(props);
  }

  publicarComentario() {
    const comentario = new Comment({
      content: content,
      studentName: this.name,
      studentRole: "profesor de " + this.skills
    })
    return Comment.publicar();
  }
}
Mi solución: \- \- \- \- ```js import { Comment } from "./Comment"; import { Student } from "./Student"; export class TeacherStudent extends Student { constructor(porps, skills = []) { super(porps); this.skills = skills; } publicarComentario(commentContent) { const comment = new Comment({ content: commentContent, studentName: this.name, studentRole: `profesor de ${this.skills}` }); return comment.publicar(); } } ```
🤡 Llevo dos días atrapada aquí porque no vi el sistema de archivos y pensé claramente que los compañeros resolvían el playground mediante: 🔥 brujería. Aquí dejo la brujería: * Arriba 👆🏻 * 👉🏻 En el título de: Sobreescribir métodos heredados * Debajo 👇🏻 * Clicando en Comment.js, Student.js o exercise.js 👈🏻
Mi código con comentarios, y si parte de mi código lo reforcé con la aportación del compañero Gonzalo Gutiérrez: ```js class TeacherStudent extends Student { // Tu código aquí 👈 // Hacer que la clase TeacherStudent herede de Student constructor( props, // Agrega un propiedad de tipo Array llamada skills a la clase TeacherStudent skills = [], ) { super(props) this.skills = skills; } // Sobrescribir el método publicar Comentario dentro de TeacherStundent. publicarComentario(commentContent) { // El string debe verse de la siguiente manera "profesor de skill1, skill2". const role = `profesor de ${this.skills.join(',')}`; const comment = new Comment({ content: commentContent, studentName: this.name, studentRole: role, }); return comment.publicar(); } } ```

Estuve cerca, pero me dieron esta solucion 😕

import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student {

  constructor(parentProps, skills) {
    super(parentProps);
    this.skills = skills;
  }

  publicarComentario(commentContent) {
    const comment = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRole: `profesor de ${this.skills}`,
    });
    return comment.publicar()
  }
}

![]()
mi solución, son 18 líneas, no sé si hay otra forma de optimizarlo aún más `import { Comment } from "./Comment";` `import { Student } from "./Student";` `export class TeacherStudent extends Student{` `  constructor(props, skills = []) {    super(props);` `    this.skills = skills;  }  publicarComentario(contenido){` ``    const role = `profesor de ${this.skills.join(",")}`;`` `    const comment = new Comment({      content: contenido,` `      studentName: this.name,` `      studentRole: role,` `    });` `    return comment.publicar();  ` `}}`
import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student {
  constructor(
    props,
    skills,
  ) {
    super(props);
    this.skills = skills;
  }

  publicarComentario(commentContent) {
    const comment = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRole: `profesor de ${this.skills}`,
    });

    return comment.publicar();
  }
}

const profesor = new TeacherStudent(
  {
    name: "Erik Ochoa",
    username: "elyager"
  },
  [
    "js",
    "python",
    "mongodb"
  ]
);
Mi humilde solución ```js import { Comment } from "./Comment"; import { Student } from "./Student"; export class TeacherStudent extends Student{ // Tu código aquí 👈 constructor(props, skills = []) { super(props); this.skills = skills; } publicarComentario(commentContent) { const comment = new Comment({ content: commentContent, studentName: this.name, studentRole: this.skills, }); const comentario = { studentName: comment.studentName + " (profesor de " + comment.studentRole.join() + ")", likes: comment.likes + " likes", content: comment.content } return comentario } } ```
import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student {
  constructor(props, skills = []) {
    super(props);
    this.skills = skills
  }

  publicarComentario(commentContent) {
    const comment = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRole: "profesor de " + this.skills.join() 
    });
    return comment.publicar();
  }
}

Solución 🚀🙂✨

Código Comment.mjs

class Comment {
  constructor({
    content,
    name_of_commenter,
    commenter_rol = "student",
  }) {
    this.content = content;
    this.name_of_commenter = name_of_commenter;
    this.commenter_rol = commenter_rol;
    this.likes = 0;
  }

  publish() {
    const comment = {
      name_of_commenter: `${this.name_of_commenter} (${this.commenter_rol})`,
      likes: `${this.likes} likes`,
      content: this.content,
    };

    return comment;
  }
}

export { Comment };

Código Student.mjs

import { Comment } from "./19.Comment.mjs";

class Student {
  constructor({
    name,
    email,
    username,
    twitter = undefined,
    instagram = undefined,
    facebook = undefined,
    approved_courses = [],
    learning_paths = [],
  }) {
    this.name = name;
    this.email = email;
    this.username = username;
    this.social_media = {
      twitter,
      instagram,
      facebook,
    };
    this.approved_courses = approved_courses;
    this.learning_paths = learning_paths;
  }

  post_comment(comment_content) {
    const comment = new Comment({
      content: comment_content,
      name_of_commenter: this.name,
    });

    return comment.publish();
  }
}
export { Student };

Código Teacher.mjs

import { Comment } from "./19.Comment.mjs";
import { Student } from "./19.Student.mjs";

class Teacher extends Student {
  // Tu código aquí 👈
  constructor(props, skills = []) {
    super(props);
    this.skills = skills;
  }

  post_comment(comment_content) {
    const comment = new Comment({
      content: comment_content,
      name_of_commenter: this.name,
      commenter_rol: this.skills,
    });

    return comment.publish();
  }
}

const teacher_one = new Teacher(
  {
    name: "Ale Roses",
    twitter: "alerxses",
  },
  ["JavaScript teacher", "TyScript teacher"]
);

console.log(teacher_one);
console.log(
  teacher_one.post_comment(`I'm your new teacher`)
);

Vista general 👈👀

Resultado en consola 💻

![](https://static.platzi.com/media/user_upload/prueba%2020-11-2023-266db2bc-11b0-4828-ba61-8ee9bda1c9f5.jpg)

reto

import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student {
  // Tu código aquí 👈
  constructor(props, skills = []) {
    super(props)
    this.skills = skills
  }
  publicarComentario(commentContent) {
    const comment = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRole: `profesor de ${this.skills}`
    });
    return comment.publicar();
  }
}```
Me pareció sencillo este ejercicio, debe ser por todo lo que he aprendido de este curso, muchas gracias!!! Con muchas ganas para continuar con el siguiente!```js import { Comment } from "./Comment"; import { Student } from "./Student"; export class TeacherStudent extends Student { constructor(props, skills = []) { super(props); this.skills = skills; } publicarComentario(commentContent) { const comment = new Comment({ content: commentContent, studentName: this.name, studentRole: 'profesor de ' + this.skills.join(), }); return comment.publicar(); } } ```

Este problema me surgio en el test

  • Porque te dicen que tiene que ser así “profesor de skill1, skill2”, cuando en realidad el resultado tiene que ser así “profesor de js,python,mongodb”
import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student {
  constructor(props, skills = []) {
    super(props);
    this.skills = skills;
  }
  publicarComentario(commentContent) {
    const comment = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRole: "profesor de " + this.skills.join(", ")
    });
    return comment.publicar();
  }
}
Tuve que ver un comentario para ver como mostar la parte de las skills (profesor de ...), resulta que era bastante simple y me estaba complicando demas. Keep it simple! Aqui dejo mi solucion, le quite los import y export para poder ejecutarlo en VS Code como un solo archivo. ```js class TeacherStudent extends Student { // Tu código aquí 👈 constructor(props, skills = []) { super(props) this.skills = skills } publicarComentario(commentContent) { const role = `profesor de ${this.skills.join(",")}` const comment = new Comment({ content: commentContent, studentName: this.name, studentRole: role, }); return comment.publicar(); } } ```class TeacherStudent extends Student { // Tu código aquí 👈 constructor(props, skills = \[]) { super(props) this.skills = skills } publicarComentario(commentContent) { const role = `profesor de ${this.skills.join(",")}` const comment = new Comment({ content: commentContent, studentName: this.name, studentRole: role, }); return comment.publicar(); }}
Tuve que ver un comentario para ver como mostar la parte de las skills (profesor de ...), resulta que era bastante simple y me estaba complicando demas. Keep it simple! Aqui dejo mi solucion, le quite los import y export para poder ejecutarlo en VS Code como un solo archivo. ```js class Comment { constructor({ content, studentName, studentRole = "estudiante", skills }) { this.content = content; this.studentName = studentName; this.studentRole = studentRole; this.likes = 0; this.skills = skills } publicar() { const comentario = { studentName: this.studentName + " (" + this.studentRole + ")", likes: this.likes + " likes", content: this.content } return comentario } } class Student { constructor({ name, email, username, twitter = undefined, instagram = undefined, facebook = undefined, approvedCourses = [], learningPaths = [], }) { this.name = name; this.email = email; this.username = username; this.socialMedia = { twitter, instagram, facebook, }; this.approvedCourses = approvedCourses; this.learningPaths = learningPaths; } publicarComentario(commentContent) { const comment = new Comment({ content: commentContent, studentName: this.name, }); return comment.publicar(); } } class TeacherStudent extends Student { // Tu código aquí 👈 constructor(props, skills = []) { super(props) this.skills = skills } publicarComentario(commentContent) { const role = `profesor de ${this.skills.join(",")}` const comment = new Comment({ content: commentContent, studentName: this.name, studentRole: role, }); return comment.publicar(); } } const skills = ["js", "python", "mongodb"] const props = { name: "Erik Ochoa", username: "elyager" } const profesor = new TeacherStudent(props, skills) profesor.publicarComentario('Mi primer comentario') ```class Comment { constructor({ content, studentName, studentRole = "estudiante", skills }) { this.content = content; this.studentName = studentName; this.studentRole = studentRole; this.likes = 0; this.skills = skills } publicar() { const comentario = { studentName: this.studentName + " (" + this.studentRole + ")", likes: this.likes + " likes", content: this.content } return comentario } } class Student { constructor({ name, email, username, twitter = undefined, instagram = undefined, facebook = undefined, approvedCourses = \[], learningPaths = \[], }) { this.name = name; this.email = email; this.username = username; this.socialMedia = { twitter, instagram, facebook, }; this.approvedCourses = approvedCourses; this.learningPaths = learningPaths; } publicarComentario(commentContent) { const comment = new Comment({ content: commentContent, studentName: this.name, }); return comment.publicar(); }} class TeacherStudent extends Student { // Tu código aquí 👈 constructor(props, skills = \[]) { super(props) this.skills = skills } publicarComentario(commentContent) { const role = `profesor de ${this.skills.join(",")}` const comment = new Comment({ content: commentContent, studentName: this.name, studentRole: role, }); return comment.publicar(); }} const skills = \["js", "python", "mongodb"] const props = { name: "Erik Ochoa", username: "elyager" } const profesor = new TeacherStudent(props, skills) profesor.publicarComentario('Mi primer comentario')

Lo hice así, me guíe del compañero Silfredo Mario (básicamente lo hicimos igual, salvo la parte de profesor de... que a mí me falto agregar)

export class TeacherStudent extends Student {
  constructor({ props, skills = [] }) {
    super(props);
    this.skills = skills;
  }

  publicarComentario(commentContent) {
    const comment = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRole: `profesor de ${this.skills.join()}`
    });
    return comment.publicar();
  }
}

Mi solución, estoy feliz 😃

import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student {
  // Tu código aquí 👈
  constructor(props, skills) {
    super(props);
    this.skills = skills;
  }
  publicarComentario(commentContent) {
    const comment = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRole: "profesor de "+ this.skills.join(","),
    });
    return comment.publicar();
  }
}

Yo no sé qué pasa con estos playgrounds que siempre que doy a correr pruebas se queda congelado y no me muestra si mi solución está bien o mal.

Agrego la forma en que solucione el reto haciendo el uso de módulos y el extensor de VisualCode.

import { Comment } from "./Comment.mjs"
import { Student } from "./Student.mjs";

export class TeacherStudent extends Student {
  constructor(props, skills) {
    super(props);
    this.skills = [skills];
  }

  publicarComentario(newComment) {
    const comentario = new Comment({
      content: newComment,
      studentName: this.name,
      studentRole: `profesor de ${this.skills}`
    });
    return comentario.publicar();
  }
}

Este es mi aporte…a pesar de que ya no corre las pruebas 😦

export class TeacherStudent {
  // Tu código aquí 👈
  constructor({ proms, skills = [] }) {
    super(proms);
    this.skills = skills;
  }

  publicarComentario(commentContent) {

    const comment = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRol: 'Profesor' + this.skills.join(','),
    });

    return comment.publicar();
  }
}

El reto ya no corre ! De todas formas :

import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent {
  // Tu código aquí 👈
  constructor({ props, skills = [] }) {
    super(props);
    this.skills = skills;
  }
  publicarComentario(commentContent) {
    const comment = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRole: "profesor " + this.skills.join(","),
    })
    return comment.publicar();

  }
}

Esta es mi solución.

import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student {
  constructor({ props, skills = [] }) {
    super(props)
    this.skills = skills;
  }

  publicarComentario(commentContent) {
    const comment = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRole: `profesor de ${this.skills.join(",")}`
    });

    comment.publicar();
  }
}

const skills = ["js", "python", "mongodb"]
const props = {
  name: "Erik Ochoa",
  username: "elyager"
}

const profesor = new TeacherStudent(props, skills)
profesor.publicarComentario('Mi primer comentario')

mi aporte

import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student {
  // Tu código aquí 👈
  constructor(props, skills = []) {
    super(props);
    this.skills = skills;
  }
  publicarComentario(commentContent) {
    const comment = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRole: 'profesor de ' + this.skills
    });
    return comment.publicar();
  }
}

Esta fue mi solución, decidí utilizar prototipos:

function TeacherStudent(props, skills){
  // Tu código aquí 👈
  Student.call(this, props)
    this.skills = skills
}

TeacherStudent.prototype = Object.create(Student.prototype);

TeacherStudent.prototype.publicarComentario = function(commentContent) {
  const comment = new Comment({
    content: commentContent,
    studentName: this.name,
    studentRole: `profesor de ${this.skills.join()}`
  })

  return comment.publicar()
}

const skills = ["js", "python", "mongodb"]
const props = {
  name: "Erik Ochoa",
  username: "elyager"
}

const profesor = new TeacherStudent(props, skills)
profesor.publicarComentario('Mi primer comentario')

Comparto mi solución del problema 😃

import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student {

  constructor(props, skills) {
    super(props),
    this.skills = skills
  }

  publicarComentario(contenido) {
    const new_comment = new Comment({
      content: contenido,
      studentName: this.name
    });
    new_comment.studentRole = `profesor de ${this.skills.join(',')}`;
    return new_comment.publicar();
  }
}

Y RECUERDEN:
Poli = Muchos
Morfismo = muchas formas

import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student{
  constructor(props, skills) {
    super(props)
    this.skills = skills
  }
  publicarComentario(content) {
    const comentario = new Comment({ content: content, studentName: this.name, studentRole: `profesor de ${this.skills.join(',')}` })
    return comentario.publicar()
  }
}

Para mi este playground fue el más fácil de los 3 que hay en el curso 😅.

Escudo antispoilers:

Mi solución

export class TeacherStudent extends Student {
  constructor(props,skills=[]) {
    super(props);
    this.skills = skills;
  }
  publicarComentario(commentContent) {
    const comment = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRole : "profesor de " + this.skills.join(",")
    });
    return comment.publicar();
  }
}

No se olviden del return en el método de publicar comentario

<code> import { Comment } from "./Comment";
import { Student } from "./Student";

export class TeacherStudent extends Student {
  constructor(props, skills = []) {
    super(props);
    this.skills = skills
  }

  publicarComentario(commentContent) {
    const comment = new Comment({
      content: commentContent,
      studentName: this.name,
      studentRole: "profesor de " + this.skills.join(",")
    })
    return comment.publicar();
  }
}

Este es mi aporte:
En el código fuente proporcionado por el profesor faltó la palabra “return” en la línea 213 (return comment.publicar()). solo eso me hizo revisar el código decenas de veces, además debo indicar también que:
studentRole: "profesor de " + this.skills
funciona de igual manera que:
studentRole: profesor de ${this.skills}

De no haber sido por ese famoso “return” mi código funcionaba al primer intento, pero en fin, creo vale el esfuerzo para no olvidarlo nunca mas. 😦

CONSEJO: Si venis desde PHP, vigilad que concatenar aqui se hace con ‘+’ y no con el punto. Vuestro cerebro no os avisara del error y podeis acabar como yo, media hora sin entender porque rol = "profesor de " . this.skills.join(’,’); no funciona xDDD

ezzz

export class TeacherStudent extends Student {
  constructor(props, skills = []) {
    super(props);
    this.skills = skills;
  }

  publicarComentario(content) {
    return ( new Comment({
      content: "Mi primer comentario",
      studentName: this.name,
      studentRole: `profesor de ${this.skills}`
    }) ).publicar();
  }
}
undefined