DEV Community

Cover image for Function to check for an empty string in one line of Javascript 😎
Richard
Richard

Posted on

Function to check for an empty string in one line of Javascript 😎

Hi there, folks.

Here you go:

const isEmpty = (string) => !string.trim()
Enter fullscreen mode Exit fullscreen mode

Welp. That's it for today's lesson, enjoy your Tuesday.

Top comments (0)