Challenge-Build-Your-Own-Array-In-Js
Challenge-Build-Your-Own-Array-In-Js copied to clipboard
My "Intro to C++" solution
My "Intro to C++" solution, at least from what I remember, except for the growth factor and the JavaScript-only functions. It's been more than a decade.
- Growth factor has linear growth. 🤷♂️
-
spliceis kind of long, not sure how to shorten it. - I chose to interact with
this.elementsas much as possible instead of usingMyArray's own functions. In a separate branch (available in my repo), I refactored to use its own functions, but to me, it became less readable, especially insplice. - Implementing the
shiftandunshiftfunctions, as useful as they are, made me wish linked lists were a thing in core JavaScript lol.
This was a fun challenge! Half of it were straightforward, but the splice function definitely threw me in for a loop. I'm interested in seeing others' solutions, especially with splice!