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

108
Views
¿Cómo crear una función que te diga qué parte de una cerca permanece sin colorear?

Necesito ayuda para comprender cómo const colorIntervals puede recibir dos argumentos como devolución de llamada (como se muestra al final).

La tarea es implementar la función colorFence(length) , donde length es la longitud total de la valla. Esta función debería devolver otra función a la que se puede llamar con argumentos left y right , donde 0 ≤ left ≤ right < length . La función devuelta colorea el segmento de la valla de izquierda a derecha (inclusive) en el color negro y devuelve la longitud total restante de la valla blanca.

Un ejemplo de interacción es el siguiente:

 const colorIntervals = colorFence(20); colorIntervals(18, 18); // The remaining length of the white fence is 19. colorIntervals(0, 3); // The remaining length of the white fence is 15. colorIntervals(17, 19); // The remaining length of the white fence is 13 (since segment 18 was already painted). colorIntervals(0, 19); // The remaining length of the white fence is 0.
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Su pregunta describe con precisión lo que necesita hacer:

  1. crear una función colorFence
  • argumentos: longitud
  • retorno: otra función
  1. crear otra función
  • argumentos: izquierda, derecha
  • devuelve 0 <= izquierda <= derecha < izquierda

A continuación encontrará un esqueleto de pseudocódigo. Intente adaptar estos requisitos al pseudocódigo.

 function first(a) { console.log("first", a) return second } function second(b, c) { console.log("second", b, c) } const firstFunctionExecution = first(1) firstFunctionExecution(2, 3) firstFunctionExecution(4, 5)

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!