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

152
Views
El número aleatorio de matriz

Quiero dejar que el número aleatorio de matrices se actualice, pero no funcionó. ¿Alguien puede darme algún consejo?

 var places=Array(50).fill({}).map( function(obj){ return { r: Math.random()*200, deg: Math.random()*360, opacity: 0 } } );
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Si está intentando crear una matriz de objetos con valores aleatorios, puede hacerlo:

El método de ciclo while normal :

 // declare empty array for later use const places = [] // iterate 50 times, for each iteration, // create and add one object with random values into array let i = 0 while(i < 50) { places.push({ r: Math.random() * 200, deg: Math.random() * 360, opacity: 0 }) i++ }

El método Array.from :

 // first argument define the length of array // second argument define function to execute for every iteration const places = Array.from({length: 50}, () => { return { r: Math.random() * 200, deg: Math.random() * 360, opacity: 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!