I'm working on a website for kids where they can play a simple Higher-Lower game with cards programmed in Jquery. I'm stuck on one particular part of my code though. I could fix it by writing a mass of double code, but there has to be a more efficient way to do it.
Edit: So the real question is, how do I call one function from another? Like a method.
I want to call my Kaartgenereren function from my Hoger() function.
function KaartGenereren() {...}
This is how I tried to call the function:
function Hoger(){
oudekaart = kaartnummer;
do{
$.Kaartgenereren(); ...}while(...)}
I've also tried it without the $. and the (), but it led to no result.
I hope someone will be able to help me. Thanks in advance!
2 Answers 2
The correct way is
KaartGenereren();
but you have to fix a typo first
Kaartgenereren vs KaartGenereren
3 Comments
function Hoger(){
oudekaart = kaartnummer;
do {
KaartGenereren();
...
} while(...);
}
KartGenererenyou should make sure the K and G are capitalized.