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

226
Views
valor de propiedad asignar a variable (variable asignar a función) devuelve indefinido

en este ejercicio, creo 2 variables asignadas a 2 funciones. La función getrandomMark devolverá un número aleatorio. en la función generarMarcaEstudiante, creo un objeto estudiante con propiedad de nombre y marcas; marcas es un objeto con propiedad es el nombre del sujeto y el valor es un número aleatorio de la función getrandomMark. pero el valor de la propiedad puede devolver indefinido como en esta imagen score () devuelve indefinido y no estoy seguro de por qué

 var score = function getRandomMark(start, end, step) { var num = start var arr = [] arr.push(num) while (num <= (end - step)) { num += step arr.push(num) } // random range [0 - arr.length - 1] var index = Math.floor(Math.random() * (arr.length + 1)) return arr[index] } // bai2 // assign var len var generateMark = function generateStudentMark(name) { var student = { "name": name, "marks": { "literature": score(0, 10 , 0.5), "maths": score(0, 10 , 0.5), "chemistry": score(0, 10 , 0.5), "history": score(0, 10 , 0.5), "biology": score(0, 10 , 0.5) } } return student } console.log(generateMark("Chi"))

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!