JavaScript function bottlesOfBeer() { for (let i=99; i>=0; i--) { var lasts = i-1;

if (i == 2) { console.log(i + " bottles of beer on the wall, " + i + " bottles of beer. Take one down and pass it around - " + lasts + " bottle of beer on the wall.");} else if (i == 1) { console.log(i + " bottle of beer on the wall, " + i + " bottle of beer. Take it down and pass it around - no more bottles of beer on the wall.");} else if (i == 0) { 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.");} else { console.log(i + " bottles of beer on the wall, " + i + " bottles of beer. Take one down and pass it around - " + lasts + " bottles of beer on the wall.");}

Zobacz też Hello world

Linki zewnętrzne 99 Bottles of Beer w ponad 1000 języków programowania 99 Bottles of Beer na stronie RosettaCode.org

Kategoria:Programowanie komputerów Kategoria:Piosenki angloamerykańskie Kategoria:Piosenki dla dzieci