1

Temat: Zadanie domowe (6)

Zadanie domowe (6)

utworzyć choinkę przy pomocy pętli i funkcji

https://i.ibb.co/xD7gL6F/Bez-tytu-u.png

Wysyłamy skrypt na adres: barxyz24@gmail.com
W tytule napisz: klasa/przedmiot/nr zadania/imię nazwisko/

2

Odp: Zadanie domowe (6)

<body>
<script>
function test1(i)
{
  for (a=1; a<=i; a++)
  if (a==1) document.write("*"); else
  if (Math.floor((Math.random()*4)+1)==2)
  document.write("*<blink>O</blink>");
  else document.write("**"); 
  document.write("<br>");
}

function test2(i)
{
  for (a=1; a<=i; a++) document.write(" ");
}

document.write("<pre>");

for (b=1; b<=30; b++) { test2(30-b); test1(b); }

for (c=1; c<=10; c++)
{ test2(25); document.write("##########<br>"); }

document.write("</pre>");

</script>