misk-jsd2 / 03-conditionals-and-loops

0 stars 10 forks source link

Mohmmed Almawash #10

Closed mo7md2 closed 5 years ago

mo7md2 commented 5 years ago

bottles_of_coke

for (let index = 99; index >= 0; index--) { let bottle = index => (index == 1 ? "bottle" : "bottles"); let numOfCoke = index => (index >= 1 ? index : (index>=0?"no more":99)); let lyrics = ${numOfCoke(index)} ${bottle(index)} of coke on the wall, + ${numOfCoke(index)} ${bottle(index)} of coke. + (index>=1?Take one down and pass it around,:Go to the store and buy some more,) + ${numOfCoke(index - 1)} ${bottle(index - 1)} of coke on the wall.; console.log(lyrics); }

random_address

var streetNumber = ['2437','9784','6574','2540','1738'] var streetName = ['King Fahd','Al-Madinah Al-Munawarah','Dhahran'] var cityName = ['Dammam','Riyadh','Tabuk','Abha','Jeddah'] var regionName = ['Arriyadh','Makkah','Northern Borders','Eastern Provience'] var zipCode = ['61234','51324','43256','14256','43511']

function random (array) { return array[Math.floor(Math.random() * array.length)] } // 34578 Dolphin Street, Wonka NY, 44506 var Address = ${random(streetNumber)} ${random(streetName)} Street,+ ${random(cityName)} ${random(regionName)}, ${random(zipCode)} console.log(Address)

morojAlh commented 5 years ago

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