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

163
Views
TypeError no capturado: no se pueden establecer propiedades de indefinido en el módulo de Javascript

El siguiente módulo de javascript agrega un div simple en un archivo html. Cuando llamé a board.drawIn() , todo funcionó bien. Pero cuando llamé a board.initIn() , obtuve,

 gomoku.js:3 Uncaught TypeError: Cannot set properties of undefined (setting 'board')

Estoy bastante confundido porque la función initIn() en realidad no hace nada más que llamar a drawIn() directamente. ¿Alguien puede ayudar?

 const board = (() => { function drawIn(container) { this.board = document.createElement('div'); this.board.classList.add('gomokuBoard'); container.appendChild(this.board); } function initIn(container) { drawIn(container); } return { drawIn, initIn }; })(); const gomoku = (() => { function initIn(container) { //board.drawIn(container); /* this works */ board.initIn(container); /* doesn't work */ } return { initIn }; })(); gomoku.initIn(document.querySelector('body'));
 .gomokuBoard { width: 100px; height: 100px; border: 1px solid black; }

about 4 years ago · Juan Pablo Isaza
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!