Debugging Scripts in the Console
The easiest way to see what data is being used inside a script. Add this script to your page (or in functions.php for sitewide use).
Then call it inside your function like this:
Then just look at your console log to see the output.
Hint: if you are tracking one variable through a script and want to see how it changes, try something like this: