Coding since 11yo, that makes it over 30 years now ~~~
Have a PhD in Comp Sci ~~~
Love to go on bike tours ~~~
I try to stay as generalist as I can in this crazy wide place coding is at now.
Nice one!
If you replace the trim() with a substring(1) then it'll work with strings that have spaces in front and behind since you're reliably adding a single space to the front, none to the back.
See the warning here re thesplit('') call. Seems the recommended way now is [...string].
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.
Nice one!
If you replace the
trim()
with asubstring(1)
then it'll work with strings that have spaces in front and behind since you're reliably adding a single space to the front, none to the back.See the warning here re the
split('')
call. Seems the recommended way now is [...string].