Time complexity: Big-O notation for nested loops that can skip iterations

When you have an algorithm that can skip many iterations due to a hash table search, do you still count the iterations that are abandoned immediately?

Hypothetical example:

var n = input.length; //e.g, [1,4,6,2,0,8]

for (var i = 0; i <n; i ++) {
visited[i] = true;

for (var j = 0; j <n; j ++) {
yes (visited)[j] === true) {
continue;
}
}
}

Another example:

dfs function (node) {
yes (visited)[node]) {
returns 0;
}

visited[node] = true;

var edges = edges[node];

for (var i = 0; i <edges.length; i ++) {
dfs (edges[i]);
}
}

// dfs (graph_that_has_cycles);