This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
Writes an error message to the console if the assertion is false. If the assertion is true, nothing will happen.
Note: This feature is available in Web Workers.
console.assert(assertion, obj1 [, obj2, ..., objN]); console.assert(assertion, msg [, subst1, ..., substN]);
- Any boolean expression. If the assertion is false, the message will get written to the console.
msg. This gives you additional control over the format of the output.
|Feature||Chrome||Firefox (Gecko)||Internet Explorer||Opera||Safari|
|Basic support||(Yes)||28.0 (28.0)||(Yes)||(Yes)||(Yes)|
|Available in workers||(Yes)||38.0 (38.0)||(Yes)||(Yes)||(Yes)|
|Feature||Android||Firefox Mobile (Gecko)||IE Mobile||Opera Mobile||Safari Mobile|
|Basic support||?||28.0 (28.0)||?||?||?|
|Available in workers||?||38.0 (38.0)||?||?||?|