“It’s only work if somebody makes you do it.” • craft code • creative ideas • cutting edge • author • senior front end architect • professional scuba diver • adventures above and below the sea level
Location
Germany
Work
Senior Front End Architect, Full Stack Engineer, Creative Technologist and Scuba Diving Professional
I closely followed the discussions and took some valuable insights for this and the upcoming code snippets.
For all the functions in this series we will stick to certain assumptions:
as long as it's javascript, we assume the user provides valid input. No type checking or other verifications.
E.g.: No more checking if it's actually an array
keep the functions as simple as possible and reduce the functionality to a core. E.g.: empty items are still items, if necessary clean the array before passing it to the function.
I adjusted the code to the function LUKESHIRU suggested.
It seems to be the simplest form and passes all my test cases (given the assumptions).
Thanks you again and looking forward to your contributions to the upcoming articles.
Cheers!
Some comments have been hidden by the post's author - find out more
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thank you all for your contributions.
I closely followed the discussions and took some valuable insights for this and the upcoming code snippets.
For all the functions in this series we will stick to certain assumptions:
as long as it's javascript, we assume the user provides valid input. No type checking or other verifications.
E.g.: No more checking if it's actually an array
keep the functions as simple as possible and reduce the functionality to a core. E.g.: empty items are still items, if necessary clean the array before passing it to the function.
I adjusted the code to the function LUKESHIRU suggested.
It seems to be the simplest form and passes all my test cases (given the assumptions).
Thanks you again and looking forward to your contributions to the upcoming articles.
Cheers!