bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/JavaScript/Debugging, Projects, and Reference
JavaScript•Debugging, Projects, and Reference

JavaScript Silent Errors

Silent Errors

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:

Example

Silent errors will not stop your program.

let x = 1 / 0;

Example

Assignment, not comparison let result = "Not Active.";
let isActive = false;
// ❌ Assignment, not comparison if (isActive = true) {
let result = "Active!";
}

Explanation

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.

Example

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");

Example

Accessing a missing property just returns undefined silently.

const user = {};
let result = user.name;

Example

JavaScript coerces types differently per operator. Type coercion hides bugs. Program continues, but logic is wrong.

let result1 = ('5' + '2');
let result2 = ('5' - '2');

See Also:

JavaScript Errors

JavaScript Error Statemets

JavaScript Error Object

JavaScript Debugging

Previous

ECMAScript 2026

Next

JavaScript Debugging Console