What does assert mean in JavaScript?
I’ve seen something like:
assert(function1() && function2() && function3(), \"some
Here is a really simple implementation of an assert function. It takes a value and a description of what you are testing.
function assert(value, description) {
var result = value ? "pass" : "fail";
console.log(result + ' - ' + description);
};
If the value evaluates to true it passes.
assert (1===1, 'testing if 1=1');
If it returns false it fails.
assert (1===2, 'testing if 1=1');