Skip to content

Edit JS script#9

Open
adnacg wants to merge 2 commits intowdi-sg:masterfrom
adnacg:master
Open

Edit JS script#9
adnacg wants to merge 2 commits intowdi-sg:masterfrom
adnacg:master

Conversation

@adnacg
Copy link
Copy Markdown

@adnacg adnacg commented May 31, 2018

No description provided.

Comment thread script.js
// return userInput + "th";
// }

// console.log(ordinalSuffix(userInput));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment since I noticed you used multiple if statements here, and elsewhere you've used if-else statements... what made you choose multiple if statements over if-else statements here?

Comment thread script.js
// var randomNumber = Math.floor(Math.random()*11)

// var enteredNumber = prompt("Enter a whole number between 1 to 10");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotta be careful... randomNumber here goes from 0 to 10, so if it does end up being 0, poor user....

Comment thread script.js

// var testArray = [1, 2, 4, 8, 16, 32, 64, 128];
// testArray = shuffle(testArray);
// console.log(testArray);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like how your variable names make sense to read as opposed to x, y, i, j, k!

Comment thread script.js
// Phonebook[addPhonebookName] = addPhonebookNumber;
// console.log("The number has been added!");
// }
// }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This loop actually inserts the entry into the phonebook multiple times since the comparison is nearly always false. Luckily Phonebook[addPhonebookName] always refers to the same entry so we don't get multiple entries...

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants