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

146
Vistas
For some reason its giving me undefined undefined undefined inthis code

class cars {
  construtor(name, color, type) {
    this.name = name;
    this.color = color;
    this.type = type;
  }

  brand(br) {
    console.log(this.name + " " + this.color + " " + this.type)
  }
}
const type1 = new cars("ferrari", "red", "Automatic");
console.log(type1)

type1.brand()

class cars2 extends cars {
  ask(text) {
    this.brand(text)
  }

}

const type2 = new cars2("BMW", "Blue", "Automatic")
type2.ask()

so i wanted it to give out the following things i wrote in consts but it gives me undefined 3 times on both.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Simply it's misspelling construtor should be constructor

class cars {
  constructor(name, color, type) {
    this.name = name;
    this.color = color;
    this.type = type;
  }

  brand(br) {
    console.log(this.name + " " + this.color + " " + this.type)
  }
}
const type1 = new cars("ferrari", "red", "Automatic");
console.log(type1)

type1.brand()

class cars2 extends cars {
  constructor(name, color, type) {
    super(name, color, type);
  } 

  ask(text) {
    this.brand(text)
  }

}

const type2 = new cars2("BMW", "Blue", "Automatic")
type2.ask()

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