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

HW Assignment 1 Complete - Annie Davis #3

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

Conversation

anniecdavis27
Copy link

(insert thumbs up here)


//let playerCardScore = 22
//let dealerCardScore = 22
function blackJack(playerCardScore, dealerCardScore) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@anniecdavis27 great job, code is clear and well structured!

const letters = word.split('')
let counter = 0
for (let i = 0; i <= word.length; i++) {
if (letters[i] === 'a' || letters[i] === 'e' || letters[i] === 'i' || letters[i] === 'o' || letters[i] === 'u' || letters[i] === 'l' || letters[i] === 'n' || letters[i] === 'r' || letters[i] === 's' || letters[i] === 't') {
Copy link
Contributor

Choose a reason for hiding this comment

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

@anniecdavis27 nice set up. Also, I like your use of the a logical or || to map group the letters to their score

//console.log(answer)

//assigns scores to letters
/*const letters = {
Copy link
Contributor

Choose a reason for hiding this comment

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

@anniecdavis27 I see where you were going here, that's also another route. great job thinking through alternative approaches

//turn to all lowercase
word = word.toLocaleLowerCase();
// test for palindrome
return Array.from(word).toString() === Array.from(word).reverse().toString()
Copy link
Contributor

Choose a reason for hiding this comment

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

@anniecdavis27 nice use of Array.from() to turn this word into an array of letters. Alternatively, split() could have also been used to serve the same purpose. Take a look at the approach used in the solution found here

@@ -208,6 +334,12 @@ console.log('Problem 5:')

// Add your code below this line

function checkForDuplicates(str) {
let repeats = /(.)\1/;
Copy link
Contributor

Choose a reason for hiding this comment

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

@anniecdavis27 nice regex! I had to look that one up :) ... the solution contains a non-regex alternative approach, you can check it out here: https://github.com/jsd20191008/hw-01-functions-solution/blob/master/pset-functions.js#L300

@kareemgrant
Copy link
Contributor

@anniecdavis27 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