DEV Community

Discussion on: undefined to string

Collapse
 
_bkeren profile image
''

You can use filter like below not to join falsy values.

['a','b','c', null , undefined].filter(a => a).join(' ')

Collapse
 
mikayil profile image
Mikayil

Great! I didn't know that! Thanks