misk-jsd2 / 03-conditionals-and-loops

0 stars 10 forks source link

sara fahad #28

Closed stop741 closed 5 years ago

stop741 commented 5 years ago

////99 bottles of coke var x=99; //know we can take it as input without any wrong in a song for(var i=x; i>=0; i--) { if(i >1) { console.log(i+" bottles of coke on the wall, "+i+" bottles of coke. Take one down and pass it around, "); } else if(i==1) { console.log(i+" bottle of coke on the wall, "+i+" bottle of coke. Take one down and pass it around, "); } else if(i<1) { console.log("No more bottles of coke on the wall, no more bottles of coke. Go to the store and buy some more, "+x+" bottles of coke on the wall."); }

}

////random address generator var random_address = [[2356,'red street','riyadh',55555],[36457,'blue street','dammam',4444],[75785,'pink street','riyadh',88888],[456322, 'gray street', 'jeddah', 99999],[47524, 'black street', 'jeddah',22222]];//random_address=[[street number, street name, city name, state name and zip code]]

Array.prototype.random = function (length) { return this[Math.floor((Math.random()*length))]; } var chosen_random_address = random_address.random(random_address.length) console.log(chosen_random_address);

morojAlh commented 5 years ago

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