Algorithms for Beginners: Bubble Sort in JavaScript in JavaScript. Algorithm is this fun buzzword that makes something sound really complicated and cool. An “algorithm” literally is just a way of doing something; it’s just a process. There is no one “correct” way to do something, but there are ways that things can be optimized. Here is a resource on how to optimize for time complexity and space complexity. It's BigO² or O(n²) meaning it takes time. For a small snippet this is not really noticeable. However if you are professionally building something that calculation or logic could take minutes, even tens of minutes.