misk-jsd2 / 03-conditionals-and-loops

0 stars 10 forks source link

Nourah Saeed AlMalki #7

Closed nourah08 closed 5 years ago

nourah08 commented 5 years ago

Assignment # 1: var b;

for (b = 99; b >= 0; b--) {

switch (b) { case 0: console.log('No more bottles of coke on the wall, no more bottles of coke. Go to the store and buy some more, 99 bottles of coke on the wall.'); break; case 1: console.log('1 bottle of coke on the wall, 1 bottle of coke.Take one down and pass it around, no more bottles of coke on the wall'); break; default: console.log(b, ' bottles of coke on the wall', b ,' bottles of coke.Take one down and pass it around', b-1,' of coke on the wall.'); break; } }


Assignment # 2: var streetnumber = [20, 30, 40, 50, 60]; var streetname = ["Maather Street", "Olaya Street", "takussaisi Street","King Fahad Street", "Tahiliah Street" ]; var cityname = ["Riyadh", "Jeddah", "Makkah", "Tubak", "Dammam"]; var statename = ["RUH", "JED", "MAK", "DEM", "HAE"]; var zipcode = [11111, 22222, 33333,44444,55555];

var r1 = Math.floor((Math.random() streetnumber.length)); var r2 = Math.floor((Math.random() streetname.length)); var r3 = Math.floor((Math.random() cityname.length)); var r4 = Math.floor((Math.random() statename.length)); var r5 = Math.floor((Math.random() * zipcode.length));

console.log(streetnumber[r1] + " " + streetname[r2]+"," +cityname[r3]+" " +statename[r4]+","+zipcode[r5]);

morojAlh commented 5 years ago

We discussed the homework one-on-one. Good job 👍🏼