How can i make check for empty string to be considered as truthy value

前端 未结 0 372
梦如初夏
梦如初夏 2021-02-01 07:23

In js empty string is considered as falsy value.


let str = \'\';

if (str) {
  alert(\'success\')
} else {
  alert(\'failure\')
}

i get printed

相关标签:
回答
  • 消灭零回复
提交回复
热议问题