assert

console.assert(expression, message)

Logs message only when the expression is false.

ParametersDesription
expressionExpress to evaluate.
messageMessage to print if express evaluates to false.
#Example
var student = {
  "name": "Niki",
  "year": "Junior",
  "major": "Graphic Design"
};

console.assert(student.major === "MBA", "Major is Graphic Design");
Assertion failed: Major is Graphic Design