, , , ,

I’m not sure just what I was doing “wrong” last week when I was trying to write and call my own functions but today I cracked the code and I have them working.

First, declare your function (I’ve called this one myFunction).

function myFunction () 
      // insert your code here

Then later, when you wish to call your function,


If you wish to be able to call your function from any point in your script, including within other functions, make sure that you declare it as a stand alone function and not one that is embedded within another.

Simple right? So just why I couldn’t make mine work last week I’m not sure. I do notice that there is no Event declaration in the () brackets, and this may have been where I was going “wrong” by putting these in.