Need help calling multiple functions

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? :confounded:

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

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.