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

Completed HW Assignment - Emily #6

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

Completed HW Assignment - Emily #6

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Oct 24, 2019

No description provided.

const playerDifference = 21 - playerCardScore
const dealerDifference = 21 - dealerCardScore

if (playerCardScore > 21 && dealerCardScore > 21) {
Copy link
Contributor

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
Copy link
Contributor

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 = { }
Copy link
Contributor

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 = {
Copy link
Contributor

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)
Copy link
Contributor

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) {
Copy link
Contributor

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('');
Copy link
Contributor

Choose a reason for hiding this comment

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

@kcycle nice!

@kareemgrant
Copy link
Contributor

@kcycle great job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants