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.");
}
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);
You just need to append all the lyrics to the string and at the end just return from the function.
I hope this will answer the question