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

158
Views
TypeError: no se puede leer la propiedad 'forEach' de null

Intento este código para verificar que val en array2 es cuadrado en val array1, mi código funciona pero aparece el error 'Error de tipo: no se puede leer la propiedad 'forEach' de nulo'

 let comp = (array1, array2) => { var index; if (array1.length === null && array2.length === null) return false; array2.forEach( (val) => { if (array1.includes(Math.sqrt(val))) { index = array1.indexOf(Math.sqrt(val)); array1.splice(index, 1); } }); return array1.length == 0 ? true : false; }
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Intente agregar esta línea en la parte superior de la función:

 let comp = (array1, array2) => { var index; if (array1 == null && array2 == null) return false; // Rest of the function }
about 4 years ago · Juan Pablo Isaza Report

0

Supongo que en lugar de verificar array2.length === null , deberías probar array2.length === 0

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!