Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zoisite gwen #57

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

zoisite gwen #57

wants to merge 2 commits into from

Conversation

Quizsnak
Copy link

aaaaaaa ty ashley

Copy link

@yangashley yangashley left a comment

Choose a reason for hiding this comment

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

Nice job on js-adagrams! I left some comments about using const instead of let. In general, you should always use const and then switch to let if you realize you need to re-assign the variable.

Also, beware of using proper white spacing when writing code. Have a look at a javascript style guide if you're needing a refresher on where whitespaces should go.

Additionally, I'd like to see smaller more frequent commits that help illustrate the history of your work.

@@ -145,7 +146,7 @@ describe("Adagrams", () => {
const words = ["XXX", "XXXX", "X", "XX"];
const correct = { word: "XXXX", score: scoreWord("XXXX") };

throw "Complete test by adding an assertion";
expect(highestScoreFrom(words)).toEqual(correct);

Choose a reason for hiding this comment

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

👍




const letterPool = {

Choose a reason for hiding this comment

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

We should name the variable with all caps and underscores to indicate that this is a constant variable LETTER_POOL

'Y': 2,
'Z': 1
};
const pointValues = {

Choose a reason for hiding this comment

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

Constant variable should be named with all caps like POINT_VALUES

@@ -120,7 +120,8 @@ describe("Adagrams", () => {
});

it("returns a score of 0 if given an empty input", () => {
throw "Complete test";
const word = '';
expect(scoreWord(word)).toBe(0);

Choose a reason for hiding this comment

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

👍

totalPoints += 8;
}

for(let index in word){

Choose a reason for hiding this comment

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

Since the variable index is not being reassigned in the for loop, we should use const here. Also, it's more descriptive to name the variable letter since the elements we're iterating over in word are the individual letters not a numerical index value

Comment on lines +155 to +159
let wordPoints = {};
let pointList = [];

for(let word of words){
let points = scoreWord(word)

Choose a reason for hiding this comment

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

Use const

let wordPoints = {};
let pointList = [];

for(let word of words){

Choose a reason for hiding this comment

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

Nitpick - proper whitespaces missing

for(let word of words){
let points = scoreWord(word)
pointList.push(points)
if(points in wordPoints){

Choose a reason for hiding this comment

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

Nitpick - proper white spaces missing for this if statement

return {'word' : currentWinner, 'score': highestPoints};
}

let range = highestScoredWords.length - 1;

Choose a reason for hiding this comment

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

Use const

Comment on lines +179 to +184
for(let i=1; i <= range; i++){
if(currentWinner.length === 10){
return {'word' : currentWinner, 'score': highestPoints};
} else if((highestScoredWords[i]).length === 10){
return {'word' : highestScoredWords[i], 'score': highestPoints};
} else if(currentWinner.length > (highestScoredWords[i]).length){

Choose a reason for hiding this comment

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

Fix up whitespaces around these statements.

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