submitting Homework 1 #4

Merged
merged 1 commit into from Nov 30, 2018

Conversation

Projects
None yet
2 participants
@luisynayan

luisynayan commented Nov 28, 2018

No description provided.

@vodnik

vodnik approved these changes Nov 30, 2018

than "1 bottles" as well as the special lyrics for no bottles remaining (Hint:
read up on if/else conditional statements at https://mdn.io/if...else).
*/
for (let bottleCount = 99; bottleCount >= 0; bottleCount--){

This comment has been minimized.

@vodnik

vodnik Nov 30, 2018

Owner

Solid loop and conditional structure! Nicely done.

let stateCode = ['CA', 'AZ', 'NY', 'KY', 'VA', 'MI', 'MA', 'NJ'];
let zipCode = ['94541', '10010', '65412', '82439', '86478', '31647'];

console.log(streetNumber[Math.floor(Math.random() * (streetNumber.length - 1))] + ' ' +

This comment has been minimized.

@vodnik

vodnik Nov 30, 2018

Owner

I love how you used the array length properties here to automate the random choices. You've written code where you could add new values to arrays (or remove them) and still be choosing randomly from all of the array indices. Well done!

function printFavorites(){
document.getElementById('favorites').innerHTML = '';
for (let i = 0; i < favoriteStartups.length; i++){
document.getElementById('favorites').innerHTML += '[' + i + ']' + favoriteStartups[i] + ' <br />';

This comment has been minimized.

@vodnik

vodnik Nov 30, 2018

Owner

I like how you incorporated numbering here using the array index value -- nice touch.

read up on if/else conditional statements at https://mdn.io/if...else).
*/
for (let bottleCount = 99; bottleCount >= 0; bottleCount--){
if (bottleCount>1){

This comment has been minimized.

@vodnik

vodnik Nov 30, 2018

Owner

You included spaces around your operators everywhere else, but just pointing it out here to remind you that it's common practice to do it every time to make your code more readable.

@vodnik vodnik merged commit ffa16e9 into vodnik:master Nov 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment