Skip to content

Branches - Farah #36

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

in-formation
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? There are some similarities when it comes to loops, there are just more syntax rules.
Did you need to use different strategies to find information online about JavaScript than you would for Ruby? Yes, had to remember to define variables. Also when I usually wanted to break in .each in Ruby, I had to instead use a for loop in JS because the .forEach in JS will not break.
What was a challenge you were able to overcome on this assignment? Ruby equivalent methods are functions in JS so they need to be written as so, even if they don't have any parameters (i.e. .split()).
What has been interesting and positive about learning a new programming language? while it's a lot of syntax sometimes, I like the way for loops read better than other loops we wrote in Ruby. The first line of a for loop in JS has all the information you need.
What is something to focus on your learnings in JavaScript in the next week? Definitely functions within functions...closures...Need to practice that.

@CheezItMan
Copy link

JS Adagrams

What We're Looking For

Feature Feedback
General
Answered comprehension questions Check, you'll encounter more practice with closures later. (after interviews)
Small commits with meaningful commit messages Doh! you forgot to commit! Gasp!
Code Requirements
drawLetters method Check
Uses appropriate data structure to store the letter distribution Check
All tests for drawLetters pass Check
usesAvailableLetters method Check
All tests for usesAvailableLetters pass Check
scoreWord method Check
Uses appropriate data structure to store the letter scores See my comment on a better way to do it.
All tests for scoreWord pass Check
Optional
highestScoreFrom method Check
Appropriately handles edge cases for tie-breaking logic Check
All tests for highestScoreFrom pass Check
Overall Nice work! You hit the learning goals here, including the optionals. Well done!

// Implement this method for wave 1
let allLettersArray = [];
for (let key in this.allLettersHash) {
for (let i = 0; i < Number(this.allLettersHash[key]); i++) {

Choose a reason for hiding this comment

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

In general I suggest avoiding use of the old-fashioned for loop in favor of alternative loops. That said, using it for a counter-driven loop like this is ok.

word = word.toUpperCase().split('');
let totalScore = 0;
for(let i = 0; i < word.length; i++) {
if (word[i] === 'A' || word[i] === 'E' || word[i] === 'I' || word[i] === 'O' || word[i] === 'U' || word[i] === 'L' || word[i] === 'N' || word[i] === 'R' || word[i] === 'S' || word[i] === 'T') {

Choose a reason for hiding this comment

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

You could do better here with a data structure like a JS object. They key being the letter and the value being the score. The way you did this is a little awkward.

mmcknett pushed a commit to mmcknett/js-adagrams that referenced this pull request Jul 13, 2022
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