DEV Community

Cover image for Function to check for an empty string in one line of Javascript ๐Ÿ˜Ž
Richard
Richard

Posted on

3 1

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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs