“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 can understand you comments and see where ou are coming from. Let me explain why I use this code.
I was using the version you posted for some time but ran into the problem that it returns false if the argument is not an array. This lead to problems in the code relying on the return value.
I'm deliberately not throwing the error,so it's not necessary to wrap it in an try ... catch - you can decide how to handle the error by yourself.
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 for your extensive contribution.
I can understand you comments and see where ou are coming from. Let me explain why I use this code.
I was using the version you posted for some time but ran into the problem that it returns
false
if the argument is not an array. This lead to problems in the code relying on the return value.I'm deliberately not throwing the error,so it's not necessary to wrap it in an
try ... catch
- you can decide how to handle the error by yourself.Cheers!