How can I print a message to the error console, preferably including a variable?
For example, something like:
print('x=%d', x);
JavaScript does not have any print object or print methods. You cannot access output devices from JavaScript. The only exception is that you can call the window.print() method in the browser to print the content of the current window.
To log out your own error message you can check if the element exists or not. Use console. error and pass an error message if the element doesn't exist.
The error() method writes an error message to the console.
log() is a function in JavaScript which is used to print any kind of variables defined before in it or to just print any message that needs to be displayed to the user. Syntax: console. log(A);
Install Firebug and then you can use console.log(...)
and console.debug(...)
, etc. (see the documentation for more).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With