Skip to content

Myrthe Dullaart#205

Open
MyrtheDullaart wants to merge 3 commits intoboolean-uk:mainfrom
MyrtheDullaart:main
Open

Myrthe Dullaart#205
MyrtheDullaart wants to merge 3 commits intoboolean-uk:mainfrom
MyrtheDullaart:main

Conversation

@MyrtheDullaart
Copy link

No description provided.

const doublePlusTripleWord = doubleAndTripleCheck(word)
const validWordCheck = checkIfWordIsWord(word)

if (validWordCheck === false) {
Copy link
Contributor

Choose a reason for hiding this comment

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

(!validWordCheck)

Comment on lines +41 to +42
total = 0
return total
Copy link
Contributor

Choose a reason for hiding this comment

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

return 0

function doubleAndTripleCheck(word) {
const doubleAndTripleWords = { doubleWord: false, tripleWord: false }

if (word === '' || word === null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

(!word)

}

if (
doublePlusTripleWord.doubleWord === true ||
Copy link
Contributor

Choose a reason for hiding this comment

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

const isDoubleWord

(word.includes('[') && !word.includes(']'))
) {
validWordCheck = false
} else if (specialChars.test(word) === true) {
Copy link
Contributor

Choose a reason for hiding this comment

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

(specialChars.test(word))

// If the word contains any brackets, the new word, without the double or triple letter should be returned
// Else, the original word should be returned
function splitWords(word) {
word = word.toUpperCase()
Copy link
Contributor

Choose a reason for hiding this comment

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

Save it to a new variable

Comment on lines +130 to +132
} else {
return word
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Unneeded

function caculateDoubleAndTripleWordScore(word) {
let doublePlusTripleWord = false
let total = 0
doublePlusTripleWord = doubleAndTripleCheck(word)
Copy link
Contributor

Choose a reason for hiding this comment

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

Move to first line let doublePlusTripleWord = doubleAndTripleCheck(word)

word = found.toString()

for (const letter of word) {
total += values[letter] * 2 * 3
Copy link
Contributor

Choose a reason for hiding this comment

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

"Magic numbers", "Magic values"

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