Skip to content

Instantly share code, notes, and snippets.

@4skinSkywalker
Created February 23, 2019 19:33
Show Gist options
  • Save 4skinSkywalker/7b0855d1713663790f88d69786775d4f to your computer and use it in GitHub Desktop.
Save 4skinSkywalker/7b0855d1713663790f88d69786775d4f to your computer and use it in GitHub Desktop.
"...challenge where users struggled most to get a perfect score and spent the longest time solving.."
function questionsMarks(string) {
let number = pair = count = 0
for (let char of string) {
if ( !isNaN(char) ) {
if (number && number + +char === 10) {
if (count !== 3) return false
pair = true
}
number = +char
count = 0
} else if (char === '?') {
count++
}
}
return pair || false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment