# Need more light on how Big O Notations works here

I started learning about Big O Notations recently and I’ve read many articles and watched helpful videos too.
Tried an example on the exponential runtime:

``````function addAndLog(array){
for ( var i = 0; i < array.length; i++ ) {
for(var j = 0; j < array.length; j++ ) {
console.log(array[i] + [j]);

}
}
}

addAndLog([ 'A', 'B', 'C', 'D', 'E']);

``````

ran it and got the results below:

But I’m having a hard time understanding the output and the logic behind it.

why does it output them repeatedly?

Hello there,

I am not sure what you are confused about?

You have called the function 3 times with different arrays as the argument.

Oh, I see now.
Thank you for your help @Sky020

If you still need more light on how Big O works here, this is not exponential complexity, but quadratic (which is much better than exponential).

That’s strange. O(n^2) Is for the exponential complexity right?

`n^2` would be quadratic and `2^n` would be exponential. To see the difference you can compare few `n` values:

``````n = 1;
n ** 2; // 1
2 ** n; // 2

n = 10;
n ** 2; // 100
2 ** n; // 1024

n = 1000;
n ** 2; // 1000000
2 ** n; // 1.0715086071862673e+301
``````

The most famous example of exponential algorithm is permutations algorithm, aka password brute forcing. You can assume numbers in cryptography hashing algorithms as `n`, so SHA-256 password has 2 ^ 256 permutations (which no computer on Earth will be able to crack in universe lifetime)

Well explained @snigo ; I understand it better now
This just blew mind. I’ll digest this one for today. Thank you for your help