JavaScript vazifalari, misollari, masalalari, topshiriqlari
while
dan foydalanish shartwhile dan foydalanib “salom” ni 10 marta konsolga chiqaring
whila dan foydalanib 0 dan 10 gacha sonlarni konsolga chiqaring
20 dan 30 gacha
-10 dan 10 gacha
0 2 4 6 8 … 20
1 3 5 7 9 … 20
4 12 36 108 … 26244
12 15 18 21 … 300
12 18 24 30 … 300
0 -1 2 -3 4 -5 6 -7 8 -9 … 300
4 -12 36 -108 … 236196
1000 500 250 125 … 0.9765625
13.5 16 18.5 21 23.5 … 248.5 251
while dan foydalanib hisoblash 3 * 3 * 3 * 3 * 3 * 3 * 3 * 3 * 3 * 3 * 3 * 3 * 3 * 3 * 3 * 3 * 3
while dan foydalanib hisoblash 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + … + 300
while dan foydalanib konsolga chiqarish -3 1 5 9 13 17 21 25 … 125
1 5 25 125 … 78125
100 89 78 67 56 45 34 23 12 1
while dan foydalanib hisoblash 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * … * 300
0 4 8 12 16 20 … 400
0 -1 2 -3 4 -5 6 -7 8 -9 … 300
Barcha sonlarni bir biriga bo’lish 1 2 3 4 5 6 7 8 9 10.
(1 / 2 = 0.5) (0.5 / 3 = 0.166666) (0.166666 / 4 = 0.041666) …
Konsolga chiqarish 10 11 9 12 8 13 7 14 6 15 5 16 4 17 3 18 2 19 1 20 0
Hisoblash 0 + 2 + 4 + 6 + … + 100
Hisoblash 0 + 3 + 6 + 9 + 12 … 102
Konsolga chiqarish 0 7 14 21 … 700
Hisoblash 2 * 4 * 6 * 8 … 100
20-ta fibonaci sonlarni konsolga chiqarish
Konsolga chiqarish 1 11 111 1111 … 1111111111
Konsolga chiqarish 1 12 123 1234 12345 123456 1234567 …
Konsolga chiqarish 12345678 1234567 123456 12345 1234 123 12 1