bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths

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

let x = 1 / 0;

Example

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

Explanation

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

// NaN - no error, just wrong data
const result = parseInt("abc");

Example

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

Example

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