Skip to content

Conversation

brilatimer
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? One pattern from Ruby I recognized: I knew a hash would work to calculate the letter score but as a hash does not exist in JS, I ended up using an object.
Did you need to use different strategies to find information online about JavaScript than you would for Ruby? I searched the JS equivalent for the Ruby syntax. I ended up coding the waves in Ruby first, and then working on translating to JS. The earlier Adagrams project was helpful, but it was actually easier to think of as a problem now vs try and re-format my previous code (especially as we have learned so much since that first Adagrams assignment). My Ruby translation of this round of Adagrams was much more sophisticated and clean than what I submitted for the first Adagrams assignment.
What was a challenge you were able to overcome on this assignment? A challenge I overcame was the initial setup for Wave 1: getting started for this project was a lot harder than I anticipated because everything is so new!
What has been interesting and positive about learning a new programming language? It has felt like a relief to lean on Ruby as a way to search for translation online, or explain code to myself.
What is something to focus on your learnings in JavaScript in the next week? Become more familiar with syntax used in JS and not forget all the brackets.

@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 -- see comment
All tests for drawLetters pass yes
usesAvailableLetters method
All tests for usesAvailableLetters pass yes
scoreWord method
Uses appropriate data structure to store the letter scores yes
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 overall. In this project you’ve taken some interesting logic and worked it into JavaScript syntax. I've left a number of inline comments for your to review focused on syntax choices, but overall, you’ve done a great job of practicing syntax.

"Z".repeat(1)
).split('');

const valueHash = {"A": 1, "E": 1, "I": 1, "O": 1, "U": 1, "L": 1, "N": 1, "R": 1, "S": 1, "T": 1, "D": 2, "G": 2, "B": 3, "C": 3, "M": 3, "P": 3, "F": 4, "H": 4, "V": 4, "W": 4, "Y": 4, "K": 5, "J": 8, "X": 8, "Q": 10, "Z": 10};

Choose a reason for hiding this comment

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

style note: each letter should be on it's own line.
In addtion, this notation
const valueHash = {A: 1, E: 1, ... }
will create
const valueHash = {"A": 1, "E": 1, ... }
`

@@ -1,8 +1,97 @@
const poolOfLetters = (

Choose a reason for hiding this comment

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

It would be best to include each of these objects poolOfLetters and valueHash inside the Adagrams module (I know this is different then what I said last week :)

letterbank[i] = temp;
}
},

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. Consider how you could refactor this so that you randomly pick ten letters, instead of shuffling the entire array.

}
}

// Check if characters from input are in handHash

Choose a reason for hiding this comment

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

This seems overly nested. Consider how your might refactor using compound conditionals.

usesAvailableLetters(input, lettersInHand) {

// Create frequency hash of lettersInHand
let handHash = new Object();

Choose a reason for hiding this comment

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

consider this syntax let handHash = {}

// Create frequency hash of lettersInHand
let handHash = new Object();
for (let l of lettersInHand) {
if (handHash.hasOwnProperty(l)) {

Choose a reason for hiding this comment

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

.hasOwnProperty if not necessary here

if (handHash[l] works

for (let l of word) {
score += valueHash[l.toUpperCase()];
}
if (word.length == 7 || word.length == 8 || word.length == 9 || word.length == 10){

Choose a reason for hiding this comment

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

consider word.length > 6 && word.length < 11

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