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

241
Views
El comportamiento de la propiedad del objeto es extraño.

Mi código:

 const w = new Window({ title: "Game Engine", width: 240, height: 160, scale: 3, }) const obj1 = new GameObject({ ctx: w.ctx, name: "Player", width: 16, height: 32, color: "blue", x: 0, y: 0, }) w.init() console.log(w) console.log(obj1)

Salida de la consola:

ingrese la descripción de la imagen aquí

¿Por qué obj1 no obtiene el ctx de w? Desde el primer registro, puedo entender que el objeto w tiene una propiedad ctx. Entonces, si quiero este ctx, tengo que escribir w.ctx (como lo estoy haciendo en la definición de mi obj1), pero no funciona

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Presumiblemente, obj1 no tiene una propiedad ctx hasta que llama al método init (y no lo hace hasta después de haber copiado el valor anterior, undefined , de la propiedad ctx ).

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!