please see link: https://www.reddit.com/r/learnjavascript/comments/s7ckfb/nedd_help_calling_multiple_functions/?utm_source=share&utm_medium=web2x&context=3
That really isnāt a lot of information. What is wrong with the output youāre getting?
i gave all the info and what it should output. Specifically this one: console.log(isIDNumberValid(ā9901014800086ā)); //should output true because the first 2 digits(99) is a valid year but it outputs false
Iām not sure that this has anything to do with āmultiple functionsā. Have you successfully tested each function individually?
yes individually i did and it gives the correct output but not when its called in the isIDNumberValid function
Did you test the regex separately?
i tested everything and the functions only gives wrong outputs when i call the isIDNumberValid function
So that is a yes, you actually did in fact test the regex separately?
yes as there cannot be letters in the id number
So you checked that
console.log(validateCheckSumDigit("9901014800086"))
returns true? But it returns false for meā¦
Again, Iām pretty sure this has absolutely nothing to do with multiple function calls.
Its tempting to jump to conclusions, but in this case, leaping to āmultiple function callsā takes your attention from the true issue.
console.log(validateCheckSumDigit(ā9901014800086ā)) //outputs false yes
but if i change last digit to a 9 inside main function or validateCheckSumDigit like this:
console.log(isIDNumberValid(ā9901014800089ā));
then it only outputs true
validateCheckSumDigit function uses the luhn algorithm so its pretty confusing, as i have to validate groups of numbers from the id number. And yes u are right that its not a āmultiple function callsā issue. I tried it with my own id number as well
Iām not sure if you still have an issue or not? It sounds like you are getting correct output?
no its sorted now thanks for another perspective, i was too focused on first two digits and it was pretty confusing because of the last digit
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.