Learn To Code

Starter template with CSS and JS included.

Click Me

Working with Functions

1 start your code with startUp

                function startUp() {
                    //...
                }
                
                $(document).ready(startUp);
                

2 Inline functions should be avoided


                // This is an example of an inline function being passed as the second argument to the on function
                $("#cmdPrimary").on("click", function () {
                    logToDom("This is an inline function.");
                });

                //This is an example of a named function also passed as the second argument.
                //the function respondToEvent is not shown
                $("#cmdPrimary").on("click", respondToEvent);