Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Java
  3. Question
Java

What does this mean - javascript is null or empty?

Asked by Maria Isabel Oct 13, 2022 613 views 1 answer
Share

About this question

I am aware of it being frowned upon to do something like write C# in JavaScript. (see this if you don't know what I'm talking about)


But as a judgment call, I think we could stand to have a relatively simple check for values that are null or empty, so I'm looking for feedback on this implementation of String.isNullOrEmpty.


String.isNullOrEmpty = function (value) {
    return (!value || value == undefined || value == "" || value.length == 0);
}


Your answer

1 Answer

More Java discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Java Blogs

Guides, tips and career advice on Java from JanBask experts.