The console.assert() static method writes an error message to the console if the assertion is false.
console.assert()
MDN Reference