What does assert
mean in JavaScript?
I’ve seen something like:
assert(function1() && function2() && function3(), \"some
As mentioned by T.J., There is no assert
in JavaScript.
However, there is a node module named assert, which is used mostly for testing. so, you might see code like:
const assert = require('assert');
assert(5 > 7);
In addition to other options like console.assert or rolling your own, you can use invariant. It has a couple of unique features:
%s
specifier).