Skip to content

Rachael Water Class#48

Open
RachaelGomez wants to merge 4 commits into
Ada-C14:masterfrom
RachaelGomez:master
Open

Rachael Water Class#48
RachaelGomez wants to merge 4 commits into
Ada-C14:masterfrom
RachaelGomez:master

Conversation

@RachaelGomez

Copy link
Copy Markdown

Assignment Submission: JS Adagrams

Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.

Reflection

Prompt Response
What patterns were you able to use from your Ruby knowledge to apply to JavaScript? conditional patterns and creating a variable then using it.
Did you need to use different strategies to find information online about JavaScript than you would for Ruby? I used the same strategy honestly, lots of stack overflow. Just searched by JavaScript instead of Ruby
What was something you needed to do independent research on for this project? What did you learn? methods for includes and max and such.
What was a challenge you were able to overcome on this assignment? I struggled working out which types of loops to use but I worked it out eventually!
What has been interesting and positive about learning a new programming language? It's nice that I understand the logic that needs to be implemented even if the syntax is different now.
What is something to focus on your learnings in JavaScript in the next week? Syntax and loops.

@beccaelenzil beccaelenzil left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

JS Adagrams

Major Learning Goals/Code Review

Criteria yes/no, and optionally any details/lines of code to reference
Correctly uses variables, and only uses const and let variables. The program prefers const variables. The program never uses var. const should be used unless the variable is re-assigned.
Practices best-practices in JavaScript syntax. There are semi-colons at the end of most lines that need semi-colons. Variables and functions are named with camelCase. ✔️
Correctly creates and calls functions within an object with proper syntax (parameters, return statements, etc.) ✔️
Uses correct syntax for conditional logic and iteration ✔️
Practices git with at least 3 small commits and meaningful commit messages ✔️
Utilizes unit tests to verify code; tests can run using the command $ npm test test/adagrams.test.js and we see test successes and/or failures ✔️

Functional Requirements

Functional Requirement yes/no
For the drawLetters function, there is an appropriate data structure to store the letter distribution. (You are more likely to draw an 'E' than an 'X'.) ✔️
Utilizes unit tests to verify code; all tests for drawLetters and usesAvailableLetters pass ✔️
Utilizes unit tests to verify code; all tests for scoreWord pass ✔️
Utilizes unit tests to verify code; all tests for highestScoreFrom pass This function is not complete.

Overall Feedback

Good work on this project. In this project you’ve taken some interesting logic and worked it into JavaScript syntax. I've left some in-line comments on ways you might consider refactoring to simplify your logic. Please let me know if you have any questions. It would be great to walk through the logic of the shuffle method and talk through the highestScoreFrom method.

Overall Feedback Criteria yes/no
Green (Meets/Exceeds Standards) 5+ in Code Review && 3+ in Functional Requirements ✔️

Code Style Bonus Awards

Was the code particularly impressive in code style for any of these reasons (or more...?)

Quality Yes?
Perfect Indentation
Descriptive/Readable
Logical/Organized

Comment thread src/adagrams.js
};

// making the pool of all letters. two loops? taken off of slackoverflow but was the "bad way" because it scales poorly.
let allLetters = []

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Not that even though allLetters is augmented, it is never reassigned, so this should be a const

Comment thread src/adagrams.js

return array;
}
let shuffledLetters = shuffle(allLetters);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
let shuffledLetters = shuffle(allLetters);
const shuffledLetters = shuffle(allLetters);

Comment thread src/adagrams.js
}
}
// console.log(allLetters)
// fully stolen from stackoverflow and I only half understand what's happening in it

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's ok to use someone else's code, but you should site the source by pasting the link as a comment. Let's talk through this method together.

Comment thread src/adagrams.js
drawLetters() {
// Implement this method for wave 1
shuffle(allLetters);
let letterHand = allLetters.slice(0,10);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
let letterHand = allLetters.slice(0,10);
const letterHand = allLetters.slice(0,10);

Comment thread src/adagrams.js
i += 1
}
else {
results.push(false)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Since you are using a for...in loop, you can return out of the loop. As such, consider just return false so that you return out of the function as soon as you find a letter that's not in the hand.

Comment thread src/adagrams.js

},
scoreWord(word){
let scoreChart = {1: ['A', 'E', 'I', 'O', 'U', 'L', 'N', 'R', 'S', 'T'],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This works! Consider how you could write the code if you use an object with keys that were letters and values that were the score for each letter.

Comment thread src/adagrams.js
},
highestScoreFrom(words){
let scoreObject = {}
for (let i = 0; i < words.length; i++) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Considering using for...of to loop through the words in the array.

Suggested change
for (let i = 0; i < words.length; i++) {
for (let word of words) {

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