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

Selam Ainalem - Amperes #46

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

SelamawitA
Copy link

JS Scrabble

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? Familiarity with loops and object oriented design made it easy to pick up for loops/forEach and understand how to take advantage of javascripts flexibility in how classes and objects are created.
What was a challenge you faced in this assignment? I’m still getting comfortable with javascript error messages, and syntax. Debugging is much more efficient for me in Ruby and Ruby on Rails. I am also still trying to understand the justification for the separation between Object and Class in javascript. Is it just syntactical sugar? Are all methods call when an object from a class is created, if not that prototypical objects do make sense?
Do you have any recommendations on how we could improve this project for the next cohort? I think this was a great project for getting us familiar with testing, javascript error message, and the concept of that/this.

… letter and value as associated score. Created score(word), that has a word(string) as an input and returns the associated score. Created method highestScoreFrom(arrayOfWords) accepts an array of words returns the highest scoring word. All methods have only been tested in the terminal.

git push origin master
…constructor that accepts a name of a player. Added play(word) - pushes played word into plays array, added totalScore() - calculates a player's total score. added hasWon() - checks if a player has won, added highestScoringWord() - returns highest scoring word, added highestWordScore() - returns the score for the highest scoring word.
… the highestSCoringWord() method from being invoked w/o a word being played. Also created a new test for highestWordScore().
…g invoked without a word being played. Tested method. All methods are currently passing. Need to update tests for edge cases.
@CheezItMan
Copy link

JS Scrabble

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene Good commit messages and good number of commits
Comprehension questions Check, I understand how JavaScript objects can be a paradigm shift.
General
score calculates score, has appropriate params and return value Check
highestScoreFrom calculates highest scoring word, has appropriate params and return value Check
Player object
Has name and plays properties Check
Has play, totalScore, hasWon functions Check
Has highestScoringWord and highestWordScore functions Check
Overall Well done, you hit all the learning goals of the project. Nice work!

const Scrabble = {
score(word) {

score_per_char(){

Choose a reason for hiding this comment

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

It makes more sense to have this as an object rather than a function which returns an object.

throw new Error('Word length must be at least 1 character.')
}

if (/^[a-zA-Z]*$(?=)/.test(word) === false){

Choose a reason for hiding this comment

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

👍


play(word){
if (word === null){

Choose a reason for hiding this comment

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

Since both null and undefined are falsy, you could just do

if (!word) {
  throw new Error(`${word} is not valid word`);
}

if (user_has_won){
return false
}else {
if (word.length)

Choose a reason for hiding this comment

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

What purpose does this if statement serve?

}

hasWon(){
if (this.totalScore() >= 100){

Choose a reason for hiding this comment

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

You could also have:

return this.totalScore() >= 100;

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