Loading lesson path
JavaScript can fail siently. A silent error will not stop your program. The execution will continue. The reason for silent errors is historical: The first version of JavaScript did not have catch...try exceptions. Silent errors are issues that do not throw exceptions or stop execution, but still cause logic bugs, unexpected behavior, or failures that are easy to miss. Below are some examples of common silent errors, with examples to try:
Silent errors will not stop your program.
let x = 1 / 0;Assignment, not comparison let result = "Not Active.";
let isActive = false;
// ❌ Assignment, not comparison if (isActive = true) {
let result = "Active!";
}Formula
The (isActive = true) assigns true to isActive, instead of checking equality with (isActive == true).The next line runs silently and prints "Active!", even though isActive is false.
Many numeric operations that fail produce NaN (not an exception). JavaScript will not crash. It just quietly gives you NaN and keeps going.
// NaN - no error, just wrong data const result = parseInt("abc");Accessing a missing property just returns undefined silently.
const user = {};
let result = user.name;JavaScript coerces types differently per operator. Type coercion hides bugs. Program continues, but logic is wrong.
let result1 = ('5' + '2');
let result2 = ('5' - '2');