Created
August 5, 2022 08:07
-
-
Save Shaxadhere/37dec18abc2991fcf76f864410d3bbb0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const QuestionsMarks =(str="acc?7??sss?3rr1??????5")=>{ | |
numberCount = 0 | |
markCount = 0 | |
markUsed=0 | |
numberSum = 0 | |
lastAdded=0 | |
result = false | |
str.split("").forEach((item) => { | |
if(!isNaN(item)) numberCount=1 | |
if(numberCount>0){ | |
if(item=="?"){ | |
markCount=markCount+1 | |
} | |
if(markCount<=3){ | |
if(!isNaN(item)){ | |
markUsed=markUsed+1 | |
if(markCount==3){ | |
if(numberSum!=10){ | |
numberSum=numberSum+parseInt(item) | |
} | |
} | |
} | |
} | |
} | |
if(numberSum==10){ | |
result = true | |
} | |
console.log(markUsed) | |
if(markUsed>3){ | |
result=false | |
} | |
}) | |
return result | |
} | |
console.log(QuestionsMarks()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment