Skip to content

Conversation

north108
Copy link

JS Adagrams

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
What patterns were you able to use from your Ruby knowledge to apply to JavaScript? The commonalities I found between the two was the logic and messages. The logic patterns from one to the other was the same and I used ruby knowledge to trace where the messages were going in the functions.
Did you need to use different strategies to find information online about JavaScript than you would for Ruby? No, same type of googling.
What was a challenge you were able to overcome on this assignment? Figuring out how to shuffle the letters was a bit challenge because there is no built in shuffle function in javascript so I had to write one of my own.
What has been interesting and positive about learning a new programming language? I actually enjoy finding out what kind of build in methods there are in the languages and which ones don't exist. It felt cool to build my own shuffle method even if I found most of the information online.
What is something to focus on your learnings in JavaScript in the next week? I would like to get more practice with arrow functions and make them second nature.

@beccaelenzil
Copy link

JS Adagrams

What We're Looking For

Feature Feedback
General
Answered comprehension questions yes
Small commits with meaningful commit messages yes
Code Requirements
drawLetters method
Uses appropriate data structure to store the letter distribution yes -- style note: move this out of the function and to the top inside the module
All tests for drawLetters pass yes
usesAvailableLetters method
All tests for usesAvailableLetters pass yes
scoreWord method yes
Uses appropriate data structure to store the letter scores yes -- style note: move this out of the function and to the top inside the module
All tests for scoreWord pass yes
Optional
highestScoreFrom method N/A
Appropriately handles edge cases for tie-breaking logic N/A
All tests for highestScoreFrom pass N/A
Overall Good work on this project! In this project you’ve taken some interesting logic and worked it into JavaScript syntax. I’ve written some inline comments for you to review, but overall, you’ve done a great job of practicing syntax.

@@ -1,7 +1,104 @@
const Adagrams = {
drawLetters() {
// Implement this method for wave 1
// eslint-disable-next-line max-len
const letters = ['A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'B', 'B', 'C', 'C', 'D', 'D', 'D', 'D', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E', 'F', 'F', 'G', 'G', 'G', 'H', 'H', 'I', 'I', 'I', 'I', 'I', 'I', 'I', 'I', 'I', 'J', 'K', 'L', 'L', 'L', 'L', 'M', 'M', 'N', 'N', 'N', 'N', 'N', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'P', 'P', 'Q', 'R', 'R', 'R', 'R', 'R', 'R', 'S', 'S', 'S', 'S', 'T', 'T', 'T', 'T', 'T', 'T', 'U', 'U', 'U', 'U', 'V', 'V', 'W', 'W', 'X', 'Y', 'Y', 'Z'];

Choose a reason for hiding this comment

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

This data structure works, but it's not very DRY and would be tricky to change. For example, suppose I said you had the wrong number of "I"s - you would have to do a lot of counting to solve the problem.

Instead you might store a hash of letter frequencies like this

letterQuantities: {
  A: 9, B: 2, ...
}

and use it to build a pool of letters dynamically.

return array;
};

const randomOrder = shuffleLetters(letters)

Choose a reason for hiding this comment

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

Here, you shuffle the entire array pool of letters... and then, you take the first ten. I think you could refactor this so that you randomly pick ten letters, instead of shuffling the entire array.


const letters = input.split('')

letters.forEach(char => {

Choose a reason for hiding this comment

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

Consider using a loop that allows you to break out so that as soon as you encounter a false you exit the loop.

},

scoreWord(input) {
const letterPoints = {

Choose a reason for hiding this comment

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

style note: move this object to ahead of all the functions, but inside the module.

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