I often find one of the most repetitive tasks when writing JavaScript is the need to constantly check the value of variables, especially as a script grows more complex.
Is there a way to automatically log the variable values to the console via calling a function?
e.g.
var foo = 1,
bar = true,
yin = ['item 1', 'item 2'],
yang = 'a string',
tan = $(this);
function() {
yang = 'another string';
}
foo += 1;
yin.push('item 3');
function logMyVariables();
would log:
foo: 2
bar: true
yin: item1, item2, item 3
yang: another string
tan: [object Object]