DEV Community

Discussion on: A simple and easy way to validate form fields

Collapse
 
sumanthapamagar profile image
sumanthapamagar

Try
return string.trim() === ''
Instead of if else, cleaner and more efficient