In my quest for a single line function, I missed the part about skipping the character if it's whitespace... so here's that tacked on too (though I added the filter to the end in order to keep the whole thing to one line) :)
Game Developer, Metaverse Creater.
With over four years of experience working in the metaverse, Theo's had the opportunity to work on top experiences, spearheading technical and creative design.
map, filter, and reduce are your friend! Whenever I'm dealing with translating one string, array, or object into another one, there's probably a way to do it by just chaining those three methods together.
Game Developer, Metaverse Creater.
With over four years of experience working in the metaverse, Theo's had the opportunity to work on top experiences, spearheading technical and creative design.
I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
In my quest for a single line function, I missed the part about skipping the character if it's whitespace... so here's that tacked on too (though I added the filter to the end in order to keep the whole thing to one line) :)
Always amazes me when people get it into one line. 👍
map
,filter
, andreduce
are your friend! Whenever I'm dealing with translating one string, array, or object into another one, there's probably a way to do it by just chaining those three methods together.Nice, I'm a python man myself and will be sure to check it out! 👍
(I believe map,filter and reduce are available in python as well....)
Minimising your javascript will get everything onto one line. I'm not sure about why you'd want to do that when showing your code to anyone though.