• Register
1 vote
23 views

Problem:

Hello Kodlogers,

I’ve completed the basic Java courses a few days ago and now focusing on web-based programming languages. I just started  JavaScript as my first preference. But the problem is I don’t know the attribute, function or method very well in JavaScript. Yeah! I know its foolish. Could you please shed some light on this?

Thanks for your help guys.

12 7 7
15,250 points

Please log in or register to answer this question.

1 Answer

1 vote

Solution:

Well, it is mandatory to read and follow the documentation carefully before starting a programming language. So, please check the Documentation before go ahead further.

If you want to check whether the string is empty/null/undefined, use the following code:

let emptyStr = "";
if (!emptyStr) {
  console.log("This String is empty");
}

let nullStr = null;
if (!nullStr) {
  console.log("This String is null");
}

 

13 9 6
94,260 points

Related questions

0 votes
1 answer 39 views
39 views
I am new to this. I just want to know how to do that?
asked Nov 17, 2020 TeamScript 13.5k points
1 vote
1 answer 4 views
4 views
Problem: Please help me. How can I solve it? javascript check for null or empty string
asked Mar 25 MUHAMMAD MUNEEB 83k points
0 votes
1 answer 25 views
25 views
Problem: I am working with textboxes in Winforms. I want to make sure that the user enters something in the textbox else an error message should be printed on the screen. How can I achieve it?
asked Oct 24, 2020 Code Learner 9.9k points
0 votes
1 answer 14 views
14 views
Problem: How can I check if a string contains another substring in javascript?Generally I would expect a method String.contains(), but there doesn't seem to be one.
asked Feb 12 sasha 16.2k points
1 vote
1 answer 2 views
2 views
Problem: Can anyone tell me the solution of this problem? javascript check for null or undefined
asked Mar 25 MUHAMMAD MUNEEB 83k points
0 votes
1 answer 5 views
5 views
Poblem: Help me checking jquery wheather the variable is empty or null.
asked Apr 10 zayed1 61.8k points
0 votes
1 answer 3 views
3 views
Problem: Does anyone know how to check string is null or not in android?
asked Mar 31 zayed1 61.8k points
0 votes
1 answer 36 views
36 views
I am new to python programming.. I was trying to check if a string is empty or whitespace in a code : Mystr= "" Yourstr = " " print ("This string is empty : ", end = "") if(not Yourstr): print ("Yes") print ("This string is empty : ", end = "") if(not Mystr): print ("No") It’s output is : This string is empty : This string is empty : No Its not giving me actual result what can I do now?
asked Mar 16, 2020 LizzyM 6.1k points
1 vote
1 answer 1 view
1 view
Problem: Any ideas on what I need to do to fix this? javascript check if string is empty
asked Mar 25 MUHAMMAD MUNEEB 83k points
0 votes
1 answer 6 views
6 views
Problem: I am getting this .. can you help me to solve it? How to check if a string is empty in c
asked 3 days ago Ifra 37.2k points