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

219
Views
Estoy tratando de crear una pirámide estelar que debe contener 1 * en la primera fila, 2 * con espacios iguales en la segunda fila, como la tercera y la cuarta fila.

 [enter image description here][1]

elemento de la lista

 let x = 4; let text = ""; for(let i = 1; i <= x; i++) { for(let j = 1; j <= x - i; j++) { text += " "; } for(let k = 0; k < 2 * i - 1; k++) { text += "*"; } text +="\n"; } console.log(text);

---La salida que quiero es así. Soy nuevo en esto. Gracias de antemano [1]: https://i.stack.imgur.com/AJvaZ.png

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Pequeño cambio:

 let x = 4; let text = ""; for(let i = 1; i <= x; i++) { for(let j = 1; j <= x - i; j++) { text += " "; } text += "*"; for(let k = 0; k + 1 < i; k++) { text += " *"; } text +="\n"; } console.log(text);
about 4 years ago · Santiago Trujillo 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!