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

272
Views
Estoy haciendo una función para imprimir la letra de la canción de 99 botellas. Cuando uso console.log, funciona pero no funciona cuando uso return
function beer() { var n = 99; while (n>1) { var m = n-1; console.log((n + "bottles of beer on the wall," + n + "bottles of beer. Take one down and pass it around," + m + "bottles of beer on the wall.")); n--; } console.log("No more bottles of beer on the wall, no more bottles of beer.Go to the store and buy some more, 99 bottles of beer on the wall."); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

 function beer() { var n = 99; var lyrics = ""; while (n > 1) { var m = n - 1; lyrics += n + "bottles of beer on the wall," + n + "bottles of beer. Take one down and pass it around," + m + "bottles of beer on the wall."; lyrics += "\n\n"; n--; } lyrics+=( "No more bottles of beer on the wall, no more bottles of beer.Go to the store and buy some more, 99 bottles of beer on the wall.\n\n" ); return lyrics; } const response = beer(); console.log(response);

Solo necesita agregar todas las letras a la cadena y al final simplemente regrese de la función.

espero que esto responda la pregunta

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!