Sprint: Subclass Dance Party

Takeaways (to be updated):

  • Always bind event handlers (because you will lose context of ‘this’).
  • If using pseudoclassical pattern, make sure it’s being used in all your files. (e.g. calling new dancerMakerFunction() in init.js).
  • Use jQuery plugins and libraries for special effects.
  • Debugging:
    • Use debugger; inside function to be tested
    • Trace the call stack
    • Hover over variables or code to see what they’re referencing
    • Remember to stop the debugger to execute the rest of the app
Advertisements
Sprint: Subclass Dance Party

debugger;

  1. Write debugger; as the first line inside your function.
  2. Inspect Element.
  3. Run the function in the Console and look at the Sources tab.  (The ‘debugger;‘ line should be highlighted in Sources).
  4. ‘Step over the next function call’ to test the code line by line as it’s running.
  5. ‘Step into the function’ if you want to go inside the callback function that’s inside the function you’re debugging.

* Create a separate function to run the debugger on any function instead of having to write debugger; in each of our function.

function runWithDebugger (ourFunction) {
    debugger;
    ourFunction();
}
debugger;