Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (13.1k points)
Can anyone help me how I can able to test the variable is undefined or not in JavaScript?

1 Answer

0 votes
by (26.7k points)

In able to do that, you can use the "typeof" operator which will help you to find the undefined variable:

if (typeof myVar !== 'undefined')

I hope this will help.

Want to become a Java Expert? Join Java Course now!!

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...