Skip to content

Latest commit

 

History

History
27 lines (22 loc) · 969 Bytes

conditional-logging-in-the-console.mdx

File metadata and controls

27 lines (22 loc) · 969 Bytes
category created tags title
Tip
2021-02-24
DevTools
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