loading...

re: 5 Programming Patterns I Like VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I don't have a computer science background so what you're referring to is not something I can easily relate to. I have a vague idea of the concept ...

O(n2), not O(n2). As in - O(n*n). As the array get bigger, the spread operator takes more and more time to perform because it needs to copy more values, as opposed to push which only needs to add one value (and sometimes increase the size, which takes longer - but it doesn't do it on each push)

O(n2), not O(n2). As in - O(n*n)

I'm aware, I just don't know how to do it on my keyboard. And yes, I do realise there's a major difference and it shouldn't be trivialised..

Anyway, thanks - I learned something new today :)

dev.to does it for you with the ^ operator - so O(n^2) becomes O(n2).

code of conduct - report abuse