Concepts

Asymptotic complexity (Big O)

Try the free JavaScript compiler

Asymptotic upper bound on a nonnegative cost function for sufficiently large n; specify the resource, cost model and case being analyzed.

Formal Syntax & Structure

javascript syntaxjavascript
T(n) = O(g(n))

Working Example

Example Snippetjavascript
const n = 4;let visits = 0;for (let i = 0; i < n; i++) {  for (let j = 0; j < n; j++) visits++;}console.log(visits);
JavaScript Reference