Javascript console.error() Method

Introduction

Write an error to the console:

console.error("You made a mistake");

Press F12 on your keyboard to view the message in the console view.

View in separate window

<!DOCTYPE html>
<html>
<body>
<script>
console.error("You made a mistake");
</script>//from   w  ww  .j  a v a2s .  co m

</body>
</html>

The console.error() method writes an error message to the console.

Syntax

console.error(message);
Parameter Type Description
message String or Object Required. The message or object to write as an error



PreviousNext

Related