I have a function that I want it execute alternating processes every time it’s triggered. Any help on how I would achieve this would be great.
function onoff(){
statusOn process /*or if on*/ statusOff process
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One interesting aspect of JavaScript is that functions are first-class objects, meaning they can have custom properties:
For this to work, your function should have a name. If your function is anonymous (unnamed), you can try to use
arguments.calleeto access it, but that is deprecated in the new ES5 standard and not possible when using its strict mode.