-
Notifications
You must be signed in to change notification settings - Fork 7
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
Completed HW Assignment - Emily #6
base: master
Are you sure you want to change the base?
Conversation
const playerDifference = 21 - playerCardScore | ||
const dealerDifference = 21 - dealerCardScore | ||
|
||
if (playerCardScore > 21 && dealerCardScore > 21) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kcycle nice job, good use of if..else if
to cover all the necessary conditions. Take a look at the solution to view an alternative if..else
structure for this problem: https://github.com/jsd20191008/hw-01-functions-solution/blob/master/pset-functions.js#L33
function wordCount (phrase) { | ||
const countArray = { } | ||
for (let i = 0; i < phrase.length; i++) { | ||
countArray[ phrase[i] ] = (countArray[phrase[i]] || 0) +1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kcycle nice use of bracket notation to build out your wordcount object
|
||
|
||
function wordCount (phrase) { | ||
const countArray = { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kcycle the name chosen for this variable is a little confusing since the actual datatype you're creating is an object and not an array
@@ -136,6 +191,48 @@ console.log('Problem 3:') | |||
|
|||
// Add your code below this line | |||
|
|||
const word = "javascript" | |||
|
|||
const scoreKey = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kcycle nice job using an object to map letters to their respective scores
const wordSplit = word.split('') | ||
|
||
const scoreArray = wordSplit.map(letter => scoreKey[letter]) | ||
const totalScore = scoreArray.reduce((a,b) => a + b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kcycle impressive use of .map()
and .reduce()
to calculate the total score associated with each word
@@ -208,6 +319,24 @@ console.log('Problem 5:') | |||
|
|||
// Add your code below this line | |||
|
|||
const wordy = 'rune' | |||
|
|||
function doubleLetters(word) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kcycle great approach, Using a variable to represent the "last letter" make your solution easy to navigate. Also, great use of a return
statement to exit out of the function as soon as a match is found
const testWord = 'run' | ||
|
||
function isPalindrome (testWord) { | ||
return testWord === testWord.split('').reverse().join(''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kcycle nice!
@kcycle great job! |
No description provided.