-
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
HW Assignment 1 Complete - Annie Davis #3
base: master
Are you sure you want to change the base?
Conversation
HW Complete - Annie Davis
|
||
//let playerCardScore = 22 | ||
//let dealerCardScore = 22 | ||
function blackJack(playerCardScore, dealerCardScore) { |
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.
@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') { |
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.
@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 = { |
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.
@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() |
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.
@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/; |
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.
@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
@anniecdavis27 great job! |
(insert thumbs up here)