console.error(). Some error messages lead to quick fixes, while others send programmers on a wild goose chase.
Apart from logging errors as they happen, we might also want to log situations where something erroneous is about to happen. These are warning messages and they're not used as much as they should be in frontend applications. Warnings are especially useful in diagnosing the more insidious problems with our code, as they leave a trail of clues in the wake of a failure.
The user doesn't necessarily see these logs if they don't have their developer tools window open, and the average user probably doesn't. Instead, we only show them the errors that are relevant to what they're doing in the application. Therefore, we can't just...