assert

console.assert(expression, message)

Logs message only when the expression is false.

Parameters

Desription

expression

Express to evaluate.

message

Message 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