Conditional logging in the Console

Use console.assert() to print out something in the Console when a given condition doesn't match.
if (condition) {
// Do something
} else {
console.log('Error message');
}
// Better
console.assert(!condition, 'Error message');

See also