Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

190
Vistas
the task is to change the getEpisodeInfo() method of the PodcastEpisode class. More details-----

Still new to Javascript.. still learning..

the task is to change the getEpisodeInfo() method of the PodcastEpisode class, so that it'll return the episode duration in a more commonly accepted format.

 function getEpisodeInfo(){
return `${this.artist}. "${this.title}" - ${this.guest} ${this.getFormattedDuration()}`;
}
  

class PodcastEpisode {
  constructor(title, artist, guest,duration){
    this.title = title;
    this.artist = artist;
    this.guest = guest;
    this.duration = duration;
    this.getEpisodeInfo =getEpisodeInfo
    
  }

  like(){
      this.isLiked = this.isLiked;
  }
   getFormattedDuration() {
    const minutes = Math.floor(this.duration / 60); // the total number of minutes
    const seconds = this.duration % 60; // the remainder of the division by 60
    return `${minutes}:${seconds > 9 ?  seconds : "0" + seconds}`; 
}
 
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I guess you're just trying to move the getEpisodeInfo function into the Class.

But, you can't use the function keyword inside the class to define a method.

Here's the full code:

class PodcastEpisode {
    constructor(title, artist, guest, duration) {
        this.title = title;
        this.artist = artist;
        this.guest = guest;
        this.duration = duration;

    }

    like() {
        this.isLiked = true;
    }
    getFormattedDuration() {
        const minutes = Math.floor(this.duration / 60); // the total number of minutes
        const seconds = this.duration % 60; // the remainder of the division by 60
        return `${minutes}:${seconds > 9 ? seconds : "0" + seconds}`;
    }

    getEpisodeInfo() {
        return `${this.artist}. "${this.title}" - ${this.guest} ${this.getFormattedDuration()}`;
    }

}

Now you can create a PodcastEpisode Object and call podcast.getEpisodeInfo().

Let me know if that's not what you're trying to do.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda