title | category | date | topics |
---|---|---|---|
Conditional logging in the Console |
Tip |
2021-02-24 17:15:00 +7 |
DevTools |
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');