Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

233
Views
Algún error en el constructor y la recursividad que parece que no entiendo

Estoy trabajando en el constructor, al principio estaba usando ES5 y mi error fue "El mensaje no es una función", luego vi algo sobre la función de flecha que no se usó con el constructor, así que la eliminé y obtuve otro error que decía "Tamaño máximo de pila de llamadas". excedido" algo acerca de la recursividad. No sé qué estoy haciendo mal exactamente. He visto muchas respuestas en el constructor, pero ninguna parece útil.

 function Message(name, motive, hubby){ this.name = name this.motive = motive this.hubby = hubby this.output=function(){ return `Hi, i'm ${this.name} i love ${this.hubby} and i would love to be your ${this.motive}.` } var Mymessage = new Message('josephine','friend', 'coding'); console.log(Mymessage.output()); } Message();
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Así es como debe crear una instancia y llamar a una función de esa instancia

 function Message(name, motive, hubby){ this.name = name this.motive = motive this.hubby = hubby this.output=function(){ return `Hi, i'm ${this.name} i love ${this.hubby} and i would love to be your ${this.motive}.` } } var Mymessage = new Message('josephine','friend', 'coding'); console.log(Mymessage.output());
about 4 years ago · Juan Pablo Isaza Report

0

 function Message(name, motive, hubby){ this.name = name this.motive = motive this.hubby = hubby this.output=function(){ return `Hi, i'm ${this.name} i love ${this.hubby} and i would love to be your ${this.motive}.` } } var Mymessage = new Message('josephine','friend', 'coding'); console.log(Mymessage.output()); Message();

Debe escribir var Mymessage fuera de la función Message, ya que la ha llamado dentro de la misma función, esa línea de código se llama a sí misma una y otra vez, lo que está causando un error.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!