Like this:
console.warn('Hi!');
Note that unlike exceptions, this will not interrupt your code; the calling function will continue normally.
Also note that this will throw an error in any browser except for WebKits or Firefox with Firebug, because console won’t exist.
To fix that, you can include Firebug Lite, or make a fake NOP-ing console object.